Module ...
Represent a game A module should subclass it and initialize anything it needs to play inside
Functions
| _M:cancelCoroutine (id) | Ask a registered coroutine to cancel The coroutine must accept a "cancel" action | 
| _M:commandLineArgs (args) | The C core gives us command line arguments | 
| _M:defaultSavedFields (t) | Defines the default fields to be saved by the savefile code | 
| _M:display (nb_keyframes) | Displays the screen Called by the engine core to redraw the screen every frame | 
| _M:getCoroutine (id) | Get the coroutine corresponding to the id | 
| _M:getPlayer () | Returns the player Reimplement it in your module, this can just return nil if you dont want/need the engine adjusting stuff to the player or if you have many players or whatever | 
| _M:getSaveDescription () | Called by savefile code to describe the current game | 
| _M:handleProfileEvent (evt) | Receives a profile event Usualy this just transfers it to the PlayerProfile class but you can overload it to handle special stuff | 
| _M:hasDialogUp () | Do we have a dialog running | 
| _M:init (keyhandler) | Constructor Sets up the default keyhandler. | 
| _M:isTainted () | Checks if the current character is "tainted" by cheating | 
| _M:joinThreads (timeout) | Try to join all registered threads | 
| _M:leaveLevel (level, lev, old_lev) | Called when a zone leaves a level Going from "old_lev" to "lev", leaving level "level" | 
| _M:onQuit () | Called by the engine when the user tries to close the window | 
| _M:onResolutionChange () | Called when screen resolution changes | 
| _M:registerCoroutine (id, co) | Add a coroutine to the pool Coroutines registered will be run each game tick | 
| _M:registerDialog (d) | Registers a dialog to display | 
| _M:registerDialogAt (d, pos) | Registers a dialog to display somewher in the stack | 
| _M:registerThread (th, linda) | Save a thread into the thread pool Threads will be auto joined when the module exits or when it can ALL THREADS registered *MUST* return true when they exit | 
| _M:replaceDialog (src, dest) | Replaces a dialog to display with an other | 
| _M:run () | Starts the game Modules should reimplement it to do whatever their game needs | 
| _M:saveGame () | Requests the game to save | 
| _M:saveSettings (file, data) | Save a settings file | 
| _M:saveVersion (token) | Gets/increment the savefile version | 
| _M:setCurrent () | Tells the game engine to play this game | 
| _M:setFlyingText (fl) | Sets up a text flyers | 
| _M:setLevel (level) | Sets the current level | 
| _M:setPlayerName (name) | Sets the player name | 
| _M:setResolution (res, force) | Change screen resolution | 
| _M:tick () | This is the "main game loop", do something here | 
| _M:unregisterDialog (d) | Undisplay a dialog, removing its own keyhandler if needed | 
Functions
- _M:cancelCoroutine (id)
- 
Ask a registered coroutine to cancel The coroutine must accept a "cancel" action
Parameters- id:
 
- _M:commandLineArgs (args)
- 
The C core gives us command line arguments
Parameters- args:
 
- _M:defaultSavedFields (t)
- 
Defines the default fields to be saved by the savefile code
Parameters- t:
 
- _M:display (nb_keyframes)
- 
Displays the screen Called by the engine core to redraw the screen every frame
Parameters- nb_keyframes: The number of elapsed keyframes since last draw (this can be 0). This is set by the engine
 
- _M:getCoroutine (id)
- 
Get the coroutine corresponding to the id
Parameters- id:
 
- _M:getPlayer ()
- Returns the player Reimplement it in your module, this can just return nil if you dont want/need the engine adjusting stuff to the player or if you have many players or whatever
- _M:getSaveDescription ()
- Called by savefile code to describe the current game
- _M:handleProfileEvent (evt)
- 
Receives a profile event Usualy this just transfers it to the PlayerProfile class but you can overload it to handle special stuff
Parameters- evt:
 
- _M:hasDialogUp ()
- Do we have a dialog running
- _M:init (keyhandler)
- 
Constructor Sets up the default keyhandler. Also requests the display size and stores it in "w" and "h" properties
Parameters- keyhandler:
 
- _M:isTainted ()
- Checks if the current character is "tainted" by cheating
- _M:joinThreads (timeout)
- 
Try to join all registered threads
Parameters- timeout: the time in seconds to wait for each thread
 
- _M:leaveLevel (level, lev, old_lev)
- 
Called when a zone leaves a level Going from "old_lev" to "lev", leaving level "level"
Parameters- level:
- lev:
- old_lev:
 
- _M:onQuit ()
- Called by the engine when the user tries to close the window
- _M:onResolutionChange ()
- Called when screen resolution changes
- _M:registerCoroutine (id, co)
- 
Add a coroutine to the pool Coroutines registered will be run each game tick
Parameters- id:
- co:
 
- _M:registerDialog (d)
- 
Registers a dialog to display
Parameters- d:
 
- _M:registerDialogAt (d, pos)
- 
Registers a dialog to display somewher in the stack
Parameters- d: the dialog
- pos: the stack position (1=top, 2=second, ...)
 
- _M:registerThread (th, linda)
- 
Save a thread into the thread pool Threads will be auto joined when the module exits or when it can ALL THREADS registered *MUST* return true when they exit
Parameters- th:
- linda:
 
- _M:replaceDialog (src, dest)
- 
Replaces a dialog to display with an other
Parameters- src:
- dest:
 
- _M:run ()
- Starts the game Modules should reimplement it to do whatever their game needs
- _M:saveGame ()
- Requests the game to save
- _M:saveSettings (file, data)
- 
Save a settings file
Parameters- file:
- data:
 
- _M:saveVersion (token)
- 
Gets/increment the savefile version
Parameters- token: if "new" this will create a new allowed save token and return it. Otherwise this checks the token against the allowed ones and returns true if it is allowed
 
- _M:setCurrent ()
- Tells the game engine to play this game
- _M:setFlyingText (fl)
- 
Sets up a text flyers
Parameters- fl:
 
- _M:setLevel (level)
- 
Sets the current level
Parameters- level: an engine.Level (or subclass) object
 
- _M:setPlayerName (name)
- 
Sets the player name
Parameters- name:
 
- _M:setResolution (res, force)
- 
Change screen resolution
Parameters- res:
- force:
 
- _M:tick ()
- This is the "main game loop", do something here
- _M:unregisterDialog (d)
- 
Undisplay a dialog, removing its own keyhandler if needed
Parameters- d: