CScriptModule Class Reference

provides the scripting functionality to other modules More...

#include <ScriptModule.h>

Inheritance diagram for CScriptModule:

CModule_Conn CModule CSingleton

List of all members.

Public Member Functions

void Init ()
void RegisterSystem ()
void FreeContext ()
bool ExecuteFile (const char *filename)
bool ExecuteString (const char *script)
bool ExecuteChunk (const char *script)
void ReceivePacket (CPacket *)
lua_State * GetState ()
bool GetVar_Int (const char *varname, int &up)
bool GetVar_String (const char *varname, string &up)
void Destroy ()

Static Public Member Functions

static CScriptModuleGetInstance ()
 sub classes should implement this for easy access to self (which is a singleton)

Protected Attributes

lua_State * lua
 the link to lua world
Ogre::Log * scrLog
 script module log manager


Detailed Description

provides the scripting functionality to other modules

since anyone can access the luastate, lua can be controlled by any module this specific module is responsible for initalizing exposing functions to lua, along with automatic file/string evaluation with simple usage


Member Function Documentation

void CScriptModule::Init (  )  [virtual]

opens lua state, loads common libs, registers C/C++ functions, executes config and other basic lua files

Implements CModule.

void CScriptModule::RegisterSystem (  ) 

Exports the desired system functionality to LUA. Called at the beginning.

void CScriptModule::FreeContext (  ) 

Frees all variables,all functions that are declared not including the system registration.

bool CScriptModule::ExecuteFile ( const char *  filename  ) 

Executes a script file. returns true on success

bool CScriptModule::ExecuteString ( const char *  script  ) 

Executes a script. returns true on success

bool CScriptModule::ExecuteChunk ( const char *  script  ) 

Executes a script. returns true on success

void CScriptModule::ReceivePacket ( CPacket  )  [virtual]

this is a connected module, it should define its behaviour

Implements CModule_Conn.

lua_State* CScriptModule::GetState (  ) 

Use this only when necessery

bool CScriptModule::GetVar_Int ( const char *  varname,
int &  up 
)

interface to access global lua variables: access integer

bool CScriptModule::GetVar_String ( const char *  varname,
string &  up 
)

interface to access global lua variables: access string

void CScriptModule::Destroy (  )  [virtual]

kill lua in the end (no matter how much it tried to do is best)

Implements CModule.


The documentation for this class was generated from the following file:

Generated on Fri Jun 13 19:46:39 2008 for OPSIMUS by  doxygen 1.5.5