Engine Hooks

From OxeyeWiki

(Difference between revisions)
Jump to: navigation, search
(Created page with '{{Daisy}} 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...')
Line 7: Line 7:
     print(key)
     print(key)
  end
  end
-
  '''hook.add("keyPressed", onKeyPress)'''
+
  '''hook.add("keyPress", onKeyPress)'''
You can add several methods to the same hook.
You can add several methods to the same hook.

Revision as of 15:54, 1 January 2010

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.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox