Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

EventInterpreter Class Reference

Uses lua to parse event files, to take relevent action. More...

#include <eventinterpreter.h>

List of all members.

Public Member Functions

 EventInterpreter (World &world, const char *file)
 updates static world pointer, and loads a lua script
 ~EventInterpreter ()
 Disengages lua.
void Function (const char *function)
 calls one of the script functions

Private Attributes

lua_State * l
 Lua State Machine.

Static Private Attributes

Worldcurrworld = 0
 Pointer to current world instance.


Detailed Description

Uses lua to parse event files, to take relevent action.

EventInterpreter uses lua to parse event scripts, which script the game. The scripts interface with the game via static functions inside this class (declaration register.h and definition in function.h using heavy macroing), which themselves interface with the engine using the static World pointer. This is because of a lua limitation (well C/C++ interface problem). To register functions with lua, they have to be called without references, and therefore to interface with the engine a static World pointer is needed. Basically this is a gateway between game scripts, and the game engine. The scripts should have 3 functions - init, proc and kill. init and kill are used when the script is loaded and unloaded, and proc is called every so often (i.e once per game loop), so that the script can test and interact with the game.


Constructor & Destructor Documentation

EventInterpreter::EventInterpreter World world,
const char *  file
 

updates static world pointer, and loads a lua script

EventInterpreter::~EventInterpreter  ) 
 

Disengages lua.


Member Function Documentation

void EventInterpreter::Function const char *  function  ) 
 

calls one of the script functions


Member Data Documentation

World * EventInterpreter::currworld = 0 [static, private]
 

Pointer to current world instance.

lua_State* EventInterpreter::l [private]
 

Lua State Machine.


The documentation for this class was generated from the following files:
Generated on Sun Mar 20 12:22:07 2005 for The Grid by doxygen 1.3.8