Engine Hooks

From OxeyeWiki

Revision as of 14:28, 29 January 2010 by Jeb (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Daisymoon Video Lib

Engine hooks are methods that are called from the game engine. They are used as event handlers, where the events can be things such as "the mouse was moved," "a key was pressed," or "the game is being rendered."

Hooks are connected to the engine by calling the global hook.add method:

local function onKeyPress(key)
   print(key)
end
hook.add("keyPress", onKeyPress)

You can add several methods to the same hook.

It is also possible to un-hook a function using hook.remove:

hook.remove("keyPress", onKeyPress)
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox