Crazy Eddies GUI System
0.6.2
|
Interface for the LuaScriptModule class. More...
Public Member Functions | |
LuaScriptModule () | |
Constructor for LuaScriptModule class which create a lua_State. | |
LuaScriptModule (lua_State *state) | |
Constructor for LuaScriptModule class which takes a lua_State. More... | |
~LuaScriptModule () | |
Destructor for LuaScriptModule class. | |
void | executeScriptFile (const String &filename, const String &resourceGroup) |
Execute a script file. More... | |
void | executeScriptFile (const String &filename, const String &resourceGroup, const String &error_handler) |
Execute a script file. More... | |
void | executeScriptFile (const String &filename, const String &resourceGroup, const int error_handler) |
Execute a script file. More... | |
int | executeScriptGlobal (const String &function_name) |
Execute a scripted global function. The function should not take any parameters and should return an integer. More... | |
int | executeScriptGlobal (const String &function_name, const String &error_handler) |
Execute a scripted global function. The function should not take any parameters and should return an integer. More... | |
int | executeScriptGlobal (const String &function_name, const int error_handler) |
Execute a scripted global function. The function should not take any parameters and should return an integer. More... | |
bool | executeScriptedEventHandler (const String &handler_name, const EventArgs &e) |
Execute a scripted global 'event handler' function by looking it up by name. More... | |
bool | executeScriptedEventHandler (const String &handler_name, const EventArgs &e, const String &error_handler) |
Execute a scripted global 'event handler' function by looking it up by name. More... | |
bool | executeScriptedEventHandler (const String &handler_name, const EventArgs &e, const int error_handler) |
Execute a scripted global 'event handler' function by looking it up by name. More... | |
void | executeString (const String &str) |
Execute script code contained in the given CEGUI::String object. More... | |
void | executeString (const String &str, const String &error_handler) |
Execute script code contained in the given CEGUI::String object. More... | |
void | executeString (const String &str, const int error_handler) |
Execute script code contained in the given CEGUI::String object. More... | |
Event::Connection | subscribeEvent (EventSet *target, const String &name, const String &subscriber_name) |
Subscribes the named Event to a scripted funtion. More... | |
Event::Connection | subscribeEvent (EventSet *target, const String &name, const String &subscriber_name, const String &error_handler) |
Subscribes the named Event to a scripted funtion. More... | |
Event::Connection | subscribeEvent (EventSet *target, const String &name, const String &subscriber_name, const int error_handler) |
Subscribes the named Event to a scripted funtion. More... | |
Event::Connection | subscribeEvent (EventSet *target, const String &name, Event::Group group, const String &subscriber_name) |
Subscribes the specified group of the named Event to a scripted funtion. More... | |
Event::Connection | subscribeEvent (EventSet *target, const String &name, Event::Group group, const String &subscriber_name, const String &error_handler) |
Subscribes the specified group of the named Event to a scripted funtion. More... | |
Event::Connection | subscribeEvent (EventSet *target, const String &name, Event::Group group, const String &subscriber_name, const int error_handler) |
Subscribes the specified group of the named Event to a scripted funtion. More... | |
void | createBindings (void) |
Method called during system initialisation, prior to running any scripts via the ScriptModule, to enable the ScriptModule to perform any operations required to complete initialisation or binding of the script language to the gui system objects. More... | |
void | destroyBindings (void) |
Method called during system destruction, after all scripts have been run via the ScriptModule, to enable the ScriptModule to perform any operations required to cleanup bindings of the script language to the gui system objects, as set-up in the earlier createBindings call. More... | |
lua_State * | getLuaState (void) const |
Method used to get a pointer to the lua_State that the script module is attached to. More... | |
void | setDefaultPCallErrorHandler (const String &error_handler_function) |
Set the name of the lua function that will be passed as the error handler in calls to lua_pcall, unless an alternative is specified in some other function call. More... | |
void | setDefaultPCallErrorHandler (int function_reference) |
Set the function that will be passed as the error handler in calls to lua_pcall, unless an alternative is specified in some other function call. More... | |
const String & | getActivePCallErrorHandlerString () const |
Return the function name string of the active error handler function. More... | |
int | getActivePCallErrorHandlerReference () const |
return the lua registry index of the active error handler function. More... | |
![]() | |
ScriptModule (void) | |
Constructor for ScriptModule base class. | |
virtual | ~ScriptModule (void) |
Destructor for ScriptModule base class. | |
const String & | getIdentifierString () const |
Return identification string for the ScriptModule. If the internal id string has not been set by the ScriptModule creator, a generic string of "Unknown scripting module" will be returned. More... | |
const String & | getLanguage () const |
Return an string which identifies the language of this module. /return String object holding a string that identifies the languge of the module | |
Additional Inherited Members | |
![]() | |
static void | setDefaultResourceGroup (const String &resourceGroup) |
Sets the default resource group to be used when loading script files. More... | |
static const String & | getDefaultResourceGroup () |
Returns the default resource group used when loading script files. More... | |
![]() | |
String | d_identifierString |
String that holds some id information about the module. | |
String | d_language |
String that holds a string containing the languge of the scripting modue. | |
![]() | |
static String | d_defaultResourceGroup |
holds the default resource group ID for loading script files. | |
Interface for the LuaScriptModule class.
CEGUI::LuaScriptModule::LuaScriptModule | ( | lua_State * | state | ) |
Constructor for LuaScriptModule class which takes a lua_State.
state | Pointer to the lua_State that the script module should attach to. |
|
virtual |
Method called during system initialisation, prior to running any scripts via the ScriptModule, to enable the ScriptModule to perform any operations required to complete initialisation or binding of the script language to the gui system objects.
Reimplemented from CEGUI::ScriptModule.
References CEGUI::Logger::logEvent().
|
virtual |
Method called during system destruction, after all scripts have been run via the ScriptModule, to enable the ScriptModule to perform any operations required to cleanup bindings of the script language to the gui system objects, as set-up in the earlier createBindings call.
Reimplemented from CEGUI::ScriptModule.
References CEGUI::Logger::logEvent().
|
virtual |
Execute a scripted global 'event handler' function by looking it up by name.
handler_name | String object holding the name of the scripted handler function. If this string contains dots '.' it will be parsed as tables containing a function field. For example: 'mytable.subtable.func' |
e | EventArgs based object that should be passed, by any appropriate means, to the scripted function. |
Implements CEGUI::ScriptModule.
bool CEGUI::LuaScriptModule::executeScriptedEventHandler | ( | const String & | handler_name, |
const EventArgs & | e, | ||
const String & | error_handler | ||
) |
Execute a scripted global 'event handler' function by looking it up by name.
handler_name | String object holding the name of the scripted handler function. If this string contains dots '.' it will be parsed as tables containing a function field. For example: 'mytable.subtable.func' |
e | EventArgs based object that should be passed, by any appropriate means, to the scripted function. |
error_handler | String containing the name of the script fuction that will be called if an error occurs while executing the handler function. NB: This is the function passed as the error handler to lua_pcall. |
bool CEGUI::LuaScriptModule::executeScriptedEventHandler | ( | const String & | handler_name, |
const EventArgs & | e, | ||
const int | error_handler | ||
) |
Execute a scripted global 'event handler' function by looking it up by name.
handler_name | String object holding the name of the scripted handler function. If this string contains dots '.' it will be parsed as tables containing a function field. For example: 'mytable.subtable.func' |
e | EventArgs based object that should be passed, by any appropriate means, to the scripted function. |
error_handler | integer value describing a lua registry reference to the function that will be called if an error occurs while executing the handler function. NB: This is the function passed as the error handler to lua_pcall. |
|
virtual |
Execute a script file.
filename | String object holding the filename of the script file that is to be executed. |
resourceGroup | Resource group idendifier to be passed to the ResourceProvider when loading the script file. |
Implements CEGUI::ScriptModule.
void CEGUI::LuaScriptModule::executeScriptFile | ( | const String & | filename, |
const String & | resourceGroup, | ||
const String & | error_handler | ||
) |
Execute a script file.
filename | String object holding the filename of the script file that is to be executed. |
resourceGroup | Resource group idendifier to be passed to the ResourceProvider when loading the script file. |
error_handler | String containing the name of the script fuction that will be called if an error occurs while executing the handler function. NB: This is the function passed as the error handler to lua_pcall. |
void CEGUI::LuaScriptModule::executeScriptFile | ( | const String & | filename, |
const String & | resourceGroup, | ||
const int | error_handler | ||
) |
Execute a script file.
filename | String object holding the filename of the script file that is to be executed. |
resourceGroup | Resource group idendifier to be passed to the ResourceProvider when loading the script file. |
error_handler | integer value describing a lua registry reference to the function that will be called if an error occurs while executing the handler function. NB: This is the function passed as the error handler to lua_pcall. |
|
virtual |
Execute a scripted global function. The function should not take any parameters and should return an integer.
function_name | String object holding the name of the function, in the global script environment, that is to be executed. |
Implements CEGUI::ScriptModule.
int CEGUI::LuaScriptModule::executeScriptGlobal | ( | const String & | function_name, |
const String & | error_handler | ||
) |
Execute a scripted global function. The function should not take any parameters and should return an integer.
function_name | String object holding the name of the function, in the global script environment, that is to be executed. |
error_handler | String containing the name of the script fuction that will be called if an error occurs while executing the handler function. NB: This is the function passed as the error handler to lua_pcall. |
int CEGUI::LuaScriptModule::executeScriptGlobal | ( | const String & | function_name, |
const int | error_handler | ||
) |
Execute a scripted global function. The function should not take any parameters and should return an integer.
function_name | String object holding the name of the function, in the global script environment, that is to be executed. |
error_handler | integer value describing a lua registry reference to the function that will be called if an error occurs while executing the handler function. NB: This is the function passed as the error handler to lua_pcall. |
|
virtual |
Execute script code contained in the given CEGUI::String object.
str | String object holding the valid script code that should be executed. |
Implements CEGUI::ScriptModule.
Execute script code contained in the given CEGUI::String object.
str | String object holding the valid script code that should be executed. |
error_handler | String containing the name of the script fuction that will be called if an error occurs while executing the handler function. NB: This is the function passed as the error handler to lua_pcall. |
void CEGUI::LuaScriptModule::executeString | ( | const String & | str, |
const int | error_handler | ||
) |
Execute script code contained in the given CEGUI::String object.
str | String object holding the valid script code that should be executed. |
error_handler | integer value describing a lua registry reference to the function that will be called if an error occurs while executing the handler function. NB: This is the function passed as the error handler to lua_pcall. |
int CEGUI::LuaScriptModule::getActivePCallErrorHandlerReference | ( | ) | const |
return the lua registry index of the active error handler function.
The 'active' error handler for the LuaScriptModule is either the default as specified by calling setDefaultPCallErrorHandler, or whatever might have been set up by a call to the internal initErrorHandlerFunc function.
References CEGUI::String::empty().
Referenced by subscribeEvent().
const String & CEGUI::LuaScriptModule::getActivePCallErrorHandlerString | ( | ) | const |
Return the function name string of the active error handler function.
The 'active' error handler for the LuaScriptModule is either the default as specified by calling setDefaultPCallErrorHandler, or whatever might have been set up by a call to the internal initErrorHandlerFunc function.
References CEGUI::String::empty().
Referenced by subscribeEvent().
|
inline |
Method used to get a pointer to the lua_State that the script module is attached to.
void CEGUI::LuaScriptModule::setDefaultPCallErrorHandler | ( | const String & | error_handler_function | ) |
Set the name of the lua function that will be passed as the error handler in calls to lua_pcall, unless an alternative is specified in some other function call.
error_handler_function | Name of the lua function to be called. This is looked up / bound on first usage. |
void CEGUI::LuaScriptModule::setDefaultPCallErrorHandler | ( | int | function_reference | ) |
Set the function that will be passed as the error handler in calls to lua_pcall, unless an alternative is specified in some other function call.
function_reference | Lua function registry index of the function to be called. |
References CEGUI::String::clear().
|
virtual |
Subscribes the named Event to a scripted funtion.
target | The target EventSet for the subscription. |
name | String object containing the name of the Event to subscribe to. |
subscriber_name | String object containing the name of the script funtion that is to be subscribed to the Event. |
Implements CEGUI::ScriptModule.
References getActivePCallErrorHandlerReference(), getActivePCallErrorHandlerString(), and CEGUI::EventSet::subscribeEvent().
Event::Connection CEGUI::LuaScriptModule::subscribeEvent | ( | EventSet * | target, |
const String & | name, | ||
const String & | subscriber_name, | ||
const String & | error_handler | ||
) |
Subscribes the named Event to a scripted funtion.
target | The target EventSet for the subscription. |
name | String object containing the name of the Event to subscribe to. |
subscriber_name | String object containing the name of the script funtion that is to be subscribed to the Event. |
error_handler | String containing the name of the script fuction that will be called if an error occurs while executing the handler function. NB: This is the function passed as the error handler to lua_pcall. |
References CEGUI::EventSet::subscribeEvent().
Event::Connection CEGUI::LuaScriptModule::subscribeEvent | ( | EventSet * | target, |
const String & | name, | ||
const String & | subscriber_name, | ||
const int | error_handler | ||
) |
Subscribes the named Event to a scripted funtion.
target | The target EventSet for the subscription. |
name | String object containing the name of the Event to subscribe to. |
subscriber_name | String object containing the name of the script funtion that is to be subscribed to the Event. |
error_handler | integer value describing a lua registry reference to the function that will be called if an error occurs while executing the handler function. NB: This is the function passed as the error handler to lua_pcall. |
References CEGUI::EventSet::subscribeEvent().
|
virtual |
Subscribes the specified group of the named Event to a scripted funtion.
target | The target EventSet for the subscription. |
name | String object containing the name of the Event to subscribe to. |
group | Group which is to be subscribed to. Subscription groups are called in ascending order. |
subscriber_name | String object containing the name of the script funtion that is to be subscribed to the Event. |
Implements CEGUI::ScriptModule.
References getActivePCallErrorHandlerReference(), getActivePCallErrorHandlerString(), and CEGUI::EventSet::subscribeEvent().
Event::Connection CEGUI::LuaScriptModule::subscribeEvent | ( | EventSet * | target, |
const String & | name, | ||
Event::Group | group, | ||
const String & | subscriber_name, | ||
const String & | error_handler | ||
) |
Subscribes the specified group of the named Event to a scripted funtion.
target | The target EventSet for the subscription. |
name | String object containing the name of the Event to subscribe to. |
group | Group which is to be subscribed to. Subscription groups are called in ascending order. |
subscriber_name | String object containing the name of the script funtion that is to be subscribed to the Event. |
error_handler | String containing the name of the script fuction that will be called if an error occurs while executing the handler function. NB: This is the function passed as the error handler to lua_pcall. |
References CEGUI::EventSet::subscribeEvent().
Event::Connection CEGUI::LuaScriptModule::subscribeEvent | ( | EventSet * | target, |
const String & | name, | ||
Event::Group | group, | ||
const String & | subscriber_name, | ||
const int | error_handler | ||
) |
Subscribes the specified group of the named Event to a scripted funtion.
target | The target EventSet for the subscription. |
name | String object containing the name of the Event to subscribe to. |
group | Group which is to be subscribed to. Subscription groups are called in ascending order. |
subscriber_name | String object containing the name of the script funtion that is to be subscribed to the Event. |
error_handler | integer value describing a lua registry reference to the function that will be called if an error occurs while executing the handler function. NB: This is the function passed as the error handler to lua_pcall. |
References CEGUI::EventSet::subscribeEvent().