LuaEvents.wiki
changeset 1756 66b51b8ba202
parent 1753 ea373c205918
child 1768 43762534f5ab
equal deleted inserted replaced
1755:b3ce3b8bc36d 1756:66b51b8ba202
     2 
     2 
     3 = Lua API: Event handlers =
     3 = Lua API: Event handlers =
     4 Event handlers are [LuaAPI Lua] functions that Hedgewars calls on certain events. Lua scripts are supposed to _define_ these functions to do something. The functions are then _called_ by Hedgewars when a certain event has occured. For an example of how this works, see [LuaGuide].
     4 Event handlers are [LuaAPI Lua] functions that Hedgewars calls on certain events. Lua scripts are supposed to _define_ these functions to do something. The functions are then _called_ by Hedgewars when a certain event has occured. For an example of how this works, see [LuaGuide].
     5 
     5 
     6 This page is a list of all supported event handlers in Hedgewars.
     6 This page is a list of all supported event handlers in Hedgewars.
       
     7 
       
     8 <wiki:toc max_depth="2" />
     7 
     9 
     8 == <tt>onGameInit()</tt> ==
    10 == <tt>onGameInit()</tt> ==
     9 This function is called before the game loads its resources. One can read and modify various [LuaGlobals#Game_variables game variables] here. These variables will become globally available after `onGameInit` has been invoked, but changing them has only an effect in `onGameInit`.
    11 This function is called before the game loads its resources. One can read and modify various [LuaGlobals#Game_variables game variables] here. These variables will become globally available after `onGameInit` has been invoked, but changing them has only an effect in `onGameInit`.
    10 Most game variables are optional, but for missions, `Theme` must be set by the scripter if you want to use a random map, rather than an image map. All other variables do not need to be set by the scripter and have default values.
    12 Most game variables are optional, but for missions, `Theme` must be set by the scripter if you want to use a random map, rather than an image map. All other variables do not need to be set by the scripter and have default values.
    11 
    13