numpad/Register

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m (Text replace - "[[Libraries/" to "[[")
(library function)
Line 2: Line 2:
 
|Name=Register
 
|Name=Register
 
|Parent=numpad
 
|Parent=numpad
|Description=Registers a numpad library action for use with [[numpad/OnDown| numpad.OnDown]] and [[numpad/OnUp| numpad.OnUp]].
+
|Description=Registers a numpad library action for use with {{LibraryFunction|numpad|OnDown}} and {{LibraryFunction|numpad|OnUp}}
 
|Realm=Server
 
|Realm=Server
 
|IsClass=No
 
|IsClass=No

Revision as of 02:37, 30 March 2013

 numpad.Register( )

Contents

Description

Registers a numpad library action for use with numpad.OnDown and numpad.OnUp

Arguments

string id

The unique id of your action.

Arguments

function func

The function to be executed.

Examples

Example

Demonstrates the use of this function.

numpad.Register("my_action", function(ply, arg1) print(ply, arg1) end
ents.FindByClass( "prop_physics" )[1].myAct = numpad.OnDown(player.GetByID(1), 38, "my_action", "arg1")

Output:

When player 1 presses his Numpad 1 key, something like this will be printed in console: "Player [1][Robot] arg1"
Personal tools
Navigation