numpad/Register

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

Revision as of 18:08, 26 February 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