Orxonox: CEGUI::LuaScriptModule Class Reference

# CEGUI::LuaScriptModule Class Reference

Interface for the LuaScriptModule class. More...

`#include <src/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILua.h>`

List of all members.

## Public Member Functions

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.

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.

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.

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.

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.

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.

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.

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.

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.
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.
bool | executeScriptedEventHandler (const String &handler_name, const EventArgs &e)
| Execute a scripted global 'event handler' function by looking it up by name.
bool | executeScriptedEventHandler (const String &handler_name, const EventArgs &e)
| Execute a scripted global 'event handler' function by looking it up by name.
bool | executeScriptedEventHandler (const String &handler_name, const EventArgs &e)
| Execute a scripted global 'event handler' function by looking it up by name.
bool | executeScriptedEventHandler (const String &handler_name, const EventArgs &e)
| Execute a scripted global 'event handler' function by looking it up by name.
void | executeScriptFile (const String &filename, const String &resourceGroup, const int error_handler)
| Execute a script file.
void | executeScriptFile (const String &filename, const String &resourceGroup, const String &error_handler)
| Execute a script file.
void | executeScriptFile (const String &filename, const String &resourceGroup)
| Execute a script file.
void | executeScriptFile (const String &filename, const String &resourceGroup)
| Execute a script file.
void | executeScriptFile (const String &filename, const String &resourceGroup)
| Execute a script file.
void | executeScriptFile (const String &filename, const String &resourceGroup)
| Execute a script file.
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.
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.
int | executeScriptGlobal (const String &function_name)
| Execute a scripted global function. The function should not take any parameters and should return an integer.
int | executeScriptGlobal (const String &function_name)
| Execute a scripted global function. The function should not take any parameters and should return an integer.
int | executeScriptGlobal (const String &function_name)
| Execute a scripted global function. The function should not take any parameters and should return an integer.
int | executeScriptGlobal (const String &function_name)
| Execute a scripted global function. The function should not take any parameters and should return an integer.
void | executeString (const String &str, const int error_handler)
| Execute script code contained in the given CEGUI::String object.
void | executeString (const String &str, const String &error_handler)
| Execute script code contained in the given CEGUI::String object.
void | executeString (const String &str)
| Execute script code contained in the given CEGUI::String object.
void | executeString (const String &str)
| Execute script code contained in the given CEGUI::String object.
void | executeString (const String &str)
| Execute script code contained in the given CEGUI::String object.
void | executeString (const String &str)
| Execute script code contained in the given CEGUI::String object.
int | getActivePCallErrorHandlerReference () const
| return the lua registry index of the active error handler function.
const String & | getActivePCallErrorHandlerString () const
| Return the function name string of the active error handler function.
lua_State * | getLuaState (void) const
| Method used to get a pointer to the lua_State that the script module is attached to.
lua_State * | getLuaState (void) const
| Method used to get a pointer to the lua_State that the script module is attached to.
lua_State * | getLuaState (void) const
| Method used to get a pointer to the lua_State that the script module is attached to.
lua_State * | getLuaState (void) const
| Method used to get a pointer to the lua_State that the script module is attached to.
| LuaScriptModule (lua_State *state)
| Constructor for LuaScriptModule class which takes a lua_State.
| LuaScriptModule ()
| Constructor for LuaScriptModule class which create a lua_State.
| LuaScriptModule (lua_State *state)
| Constructor for LuaScriptModule class which takes a lua_State.
| LuaScriptModule ()
| Constructor for LuaScriptModule class which create a lua_State.
| LuaScriptModule (lua_State *state)
| Constructor for LuaScriptModule class which takes a lua_State.
| LuaScriptModule ()
| Constructor for LuaScriptModule class which create a lua_State.
| LuaScriptModule (lua_State *state)
| Constructor for LuaScriptModule class which takes a lua_State.
| LuaScriptModule ()
| Constructor for LuaScriptModule class which create a lua_State.
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.
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.
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.
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.
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.
Event::Connection | subscribeEvent (EventSet *target, const String &name, const String &subscriber_name, const int error_handler)
| Subscribes the named Event to a scripted funtion.
Event::Connection | subscribeEvent (EventSet *target, const String &name, const String &subscriber_name, const String &error_handler)
| Subscribes the named Event to a scripted funtion.
Event::Connection | subscribeEvent (EventSet *target, const String &name, const String &subscriber_name)
| Subscribes the named Event to a scripted funtion.
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.
Event::Connection | subscribeEvent (EventSet *target, const String &name, const String &subscriber_name)
| Subscribes the named Event to a scripted funtion.
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.
Event::Connection | subscribeEvent (EventSet *target, const String &name, const String &subscriber_name)
| Subscribes the named Event to a scripted funtion.
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.
Event::Connection | subscribeEvent (EventSet *target, const String &name, const String &subscriber_name)
| Subscribes the named Event to a scripted funtion.
| ~LuaScriptModule ()
| Destructor for LuaScriptModule class.
| ~LuaScriptModule ()
| Destructor for LuaScriptModule class.
| ~LuaScriptModule ()
| Destructor for LuaScriptModule class.
| ~LuaScriptModule ()
| Destructor for LuaScriptModule class.

## Private Member Functions

void | cleanupErrorHandlerFunc ()
bool | executeScriptedEventHandler_impl (const String &handler_name, const EventArgs &e, const int err_idx, const int top)
| Implementation function that executes a scripted event handler.
void | executeScriptFile_impl (const String &filename, const String &resourceGroup, const int err_idx, const int top)
| Implementation function that executes a scipt file.
int | executeScriptGlobal_impl (const String &function_name, const int err_idx, const int top)
| Implementation function that executes a global script function.
void | executeString_impl (const String &str, const int err_idx, const int top)
| Implementation function that executes script contained in a String.
int | initErrorHandlerFunc (int func)
int | initErrorHandlerFunc (const String func_name)
int | initErrorHandlerFunc ()
void | setModuleIdentifierString ()
void | setModuleIdentifierString ()
void | setModuleIdentifierString ()
void | setModuleIdentifierString ()
void | unrefErrorFunc ()
| release any reference we might have made to an error handling function.

## Private Attributes

int | d_activeErrFuncIndex
String | d_activeErrFuncName
int | d_errFuncIndex
| Default registry index of the function to pass to lua_pcall.
String | d_errFuncName
| Default error handler function to pass to lua_pcall.
bool | d_ownsState
| true when the attached lua_State was created by this script module
lua_State * | d_state
| The lua_State that this script module uses.

## Detailed Description

Interface for the LuaScriptModule class.

## Constructor & Destructor Documentation

CEGUI::LuaScriptModule::LuaScriptModule | ( |  | ) |

Constructor for LuaScriptModule class which create a lua_State.

References d_ownsState, d_state, and setModuleIdentifierString().

CEGUI::LuaScriptModule::LuaScriptModule | ( | lua_State * | state | ) |

Constructor for LuaScriptModule class which takes a lua_State.

Parameters:

  | state | Pointer to the lua_State that the script module should attach to.

References d_ownsState, d_state, and setModuleIdentifierString().

CEGUI::LuaScriptModule::~LuaScriptModule | ( |  | ) |

Destructor for LuaScriptModule class.

References d_ownsState, and d_state.

CEGUI::LuaScriptModule::LuaScriptModule | ( |  | ) |

Constructor for LuaScriptModule class which create a lua_State.

CEGUI::LuaScriptModule::LuaScriptModule | ( | lua_State * | state | ) |

Constructor for LuaScriptModule class which takes a lua_State.

Parameters:

  | state | Pointer to the lua_State that the script module should attach to.

CEGUI::LuaScriptModule::~LuaScriptModule | ( |  | ) |

Destructor for LuaScriptModule class.

CEGUI::LuaScriptModule::LuaScriptModule | ( |  | ) |

Constructor for LuaScriptModule class which create a lua_State.

CEGUI::LuaScriptModule::LuaScriptModule | ( | lua_State * | state | ) |

Constructor for LuaScriptModule class which takes a lua_State.

Parameters:

  | state | Pointer to the lua_State that the script module should attach to.

CEGUI::LuaScriptModule::~LuaScriptModule | ( |  | ) |

Destructor for LuaScriptModule class.

CEGUI::LuaScriptModule::LuaScriptModule | ( |  | ) |

Constructor for LuaScriptModule class which create a lua_State.

CEGUI::LuaScriptModule::LuaScriptModule | ( | lua_State * | state | ) |

Constructor for LuaScriptModule class which takes a lua_State.

Parameters:

  | state | Pointer to the lua_State that the script module should attach to.

CEGUI::LuaScriptModule::~LuaScriptModule | ( |  | ) |

Destructor for LuaScriptModule class.

## Member Function Documentation

void CEGUI::LuaScriptModule::cleanupErrorHandlerFunc | ( |  | ) | `[private]`

do any needed cleanup after having called initErrorHandlerFunc and (possible) executed a script.

NB: This probably does less than you think ;)

References d_activeErrFuncIndex, and d_activeErrFuncName.

Referenced by executeScriptedEventHandler(), executeScriptFile(), executeScriptGlobal(), and executeString().

void CEGUI::LuaScriptModule::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.

Returns:
  Nothing.

void CEGUI::LuaScriptModule::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.

Returns:
  Nothing.

void CEGUI::LuaScriptModule::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.

Returns:
  Nothing.

void CEGUI::LuaScriptModule::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.

Returns:
  Nothing.

References d_state, and tolua_CEGUI_open().

void CEGUI::LuaScriptModule::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.

Returns:
  Nothing.

void CEGUI::LuaScriptModule::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.

Returns:
  Nothing.

void CEGUI::LuaScriptModule::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.

Returns:
  Nothing.

void CEGUI::LuaScriptModule::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.

Returns:
  Nothing.

References d_state.

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.

Parameters:

  | 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.

Returns:
  - true if the event was handled.
  - false if the event was not handled.

References cleanupErrorHandlerFunc(), d_state, executeScriptedEventHandler_impl(), and initErrorHandlerFunc().

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.

Parameters:

  | 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.

Returns:
  - true if the event was handled.
  - false if the event was not handled.

References cleanupErrorHandlerFunc(), d_state, executeScriptedEventHandler_impl(), and initErrorHandlerFunc().

bool CEGUI::LuaScriptModule::executeScriptedEventHandler | ( | const String & | handler_name,
|  | const EventArgs & | e |
| ) |  |  |

Execute a scripted global 'event handler' function by looking it up by name.

Parameters:

  | 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.

Returns:
  - true if the event was handled.
  - false if the event was not handled.

bool CEGUI::LuaScriptModule::executeScriptedEventHandler | ( | const String & | handler_name,
|  | const EventArgs & | e |
| ) |  |  |

Execute a scripted global 'event handler' function by looking it up by name.

Parameters:

  | 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.

Returns:
  - true if the event was handled.
  - false if the event was not handled.

bool CEGUI::LuaScriptModule::executeScriptedEventHandler | ( | const String & | handler_name,
|  | const EventArgs & | e |
| ) |  |  |

Execute a scripted global 'event handler' function by looking it up by name.

Parameters:

  | 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.

Returns:
  - true if the event was handled.
  - false if the event was not handled.

bool CEGUI::LuaScriptModule::executeScriptedEventHandler | ( | const String & | handler_name,
|  | const EventArgs & | e |
| ) |  |  |

Execute a scripted global 'event handler' function by looking it up by name.

Parameters:

  | 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.

Returns:
  - true if the event was handled.
  - false if the event was not handled.

References d_state, CEGUI::LuaFunctor::pushNamedFunction(), orxonox::MT_Type::String, and tolua_pushusertype().

bool CEGUI::LuaScriptModule::executeScriptedEventHandler_impl | ( | const String & | handler_name,
|  | const EventArgs & | e,
|  | const int | err_idx,
|  | const int | top |
| ) |  |  | `[private]`

Implementation function that executes a scripted event handler.

References d_state, CEGUI::LuaFunctor::pushNamedFunction(), orxonox::MT_Type::String, and tolua_pushusertype().

Referenced by executeScriptedEventHandler().

void CEGUI::LuaScriptModule::executeScriptFile | ( | const String & | filename,
|  | const String & | resourceGroup,
|  | const int | error_handler |
| ) |  |  |

Execute a script file.

Parameters:

  | 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.

References cleanupErrorHandlerFunc(), d_state, executeScriptFile_impl(), and initErrorHandlerFunc().

void CEGUI::LuaScriptModule::executeScriptFile | ( | const String & | filename,
|  | const String & | resourceGroup,
|  | const String & | error_handler |
| ) |  |  |

Execute a script file.

Parameters:

  | 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.

References cleanupErrorHandlerFunc(), d_state, executeScriptFile_impl(), and initErrorHandlerFunc().

void CEGUI::LuaScriptModule::executeScriptFile | ( | const String & | filename,
|  | const String & | resourceGroup |
| ) |  |  |

Execute a script file.

Parameters:

  | 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.

void CEGUI::LuaScriptModule::executeScriptFile | ( | const String & | filename,
|  | const String & | resourceGroup |
| ) |  |  |

Execute a script file.

Parameters:

  | 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.

void CEGUI::LuaScriptModule::executeScriptFile | ( | const String & | filename,
|  | const String & | resourceGroup |
| ) |  |  |

Execute a script file.

Parameters:

  | 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.

void CEGUI::LuaScriptModule::executeScriptFile | ( | const String & | filename,
|  | const String & | resourceGroup |
| ) |  |  |

Execute a script file.

Parameters:

  | 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.

References d_state, and orxonox::MT_Type::String.

Referenced by orxonox::GUIManager::loadLuaCode().

void CEGUI::LuaScriptModule::executeScriptFile_impl | ( | const String & | filename,
|  | const String & | resourceGroup,
|  | const int | err_idx,
|  | const int | top |
| ) |  |  | `[private]`

Implementation function that executes a scipt file.

References d_state, and orxonox::MT_Type::String.

Referenced by executeScriptFile().

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.

Parameters:

  | 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.

Returns:
  The integer value returned from the script function.

References cleanupErrorHandlerFunc(), d_state, executeScriptGlobal_impl(), and initErrorHandlerFunc().

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.

Parameters:

  | 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.

Returns:
  The integer value returned from the script function.

References cleanupErrorHandlerFunc(), d_state, executeScriptGlobal_impl(), and initErrorHandlerFunc().

int CEGUI::LuaScriptModule::executeScriptGlobal | ( | const String & | function_name | ) |

Execute a scripted global function. The function should not take any parameters and should return an integer.

Parameters:

  | function_name | String object holding the name of the function, in the global script environment, that is to be executed.

Returns:
  The integer value returned from the script function.

int CEGUI::LuaScriptModule::executeScriptGlobal | ( | const String & | function_name | ) |

Execute a scripted global function. The function should not take any parameters and should return an integer.

Parameters:

  | function_name | String object holding the name of the function, in the global script environment, that is to be executed.

Returns:
  The integer value returned from the script function.

int CEGUI::LuaScriptModule::executeScriptGlobal | ( | const String & | function_name | ) |

Execute a scripted global function. The function should not take any parameters and should return an integer.

Parameters:

  | function_name | String object holding the name of the function, in the global script environment, that is to be executed.

Returns:
  The integer value returned from the script function.

int CEGUI::LuaScriptModule::executeScriptGlobal | ( | const String & | function_name | ) |

Execute a scripted global function. The function should not take any parameters and should return an integer.

Parameters:

  | function_name | String object holding the name of the function, in the global script environment, that is to be executed.

Returns:
  The integer value returned from the script function.

References d_state, and orxonox::MT_Type::String.

int CEGUI::LuaScriptModule::executeScriptGlobal_impl | ( | const String & | function_name,
|  | const int | err_idx,
|  | const int | top |
| ) |  |  | `[private]`

Implementation function that executes a global script function.

References d_state, and orxonox::MT_Type::String.

Referenced by executeScriptGlobal().

void CEGUI::LuaScriptModule::executeString | ( | const String & | str,
|  | const int | error_handler |
| ) |  |  |

Execute script code contained in the given CEGUI::String object.

Parameters:

  | 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.

Returns:
  Nothing.

References cleanupErrorHandlerFunc(), d_state, executeString_impl(), and initErrorHandlerFunc().

void CEGUI::LuaScriptModule::executeString | ( | const String & | str,
|  | const String & | error_handler |
| ) |  |  |

Execute script code contained in the given CEGUI::String object.

Parameters:

  | 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.

Returns:
  Nothing.

References cleanupErrorHandlerFunc(), d_state, executeString_impl(), and initErrorHandlerFunc().

void CEGUI::LuaScriptModule::executeString | ( | const String & | str | ) |

Execute script code contained in the given CEGUI::String object.

Parameters:

  | str | String object holding the valid script code that should be executed.

Returns:
  Nothing.

void CEGUI::LuaScriptModule::executeString | ( | const String & | str | ) |

Execute script code contained in the given CEGUI::String object.

Parameters:

  | str | String object holding the valid script code that should be executed.

Returns:
  Nothing.

void CEGUI::LuaScriptModule::executeString | ( | const String & | str | ) |

Execute script code contained in the given CEGUI::String object.

Parameters:

  | str | String object holding the valid script code that should be executed.

Returns:
  Nothing.

void CEGUI::LuaScriptModule::executeString | ( | const String & | str | ) |

Execute script code contained in the given CEGUI::String object.

Parameters:

  | str | String object holding the valid script code that should be executed.

Returns:
  Nothing.

References d_state, and orxonox::MT_Type::String.

Referenced by orxonox::GUIManager::executeCode(), and orxonox::GUIManager::showGUI().

void CEGUI::LuaScriptModule::executeString_impl | ( | const String & | str,
|  | const int | err_idx,
|  | const int | top |
| ) |  |  | `[private]`

Implementation function that executes script contained in a String.

References d_state, and orxonox::MT_Type::String.

Referenced by executeString().

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.

This may return a value previously set by the user, or the value as
  bound internally by the script module for an error handler specified by function name.

Note:
  This function is really intended for use internally by other parts of the lua scripting support. Although it could be useful elsewhere for advanced uses, so long as you're careful!

Warning:
  You should never call luaL_unref on the value returned by this function unless you created tge reference in the first place, and even then only after having called setDefaultPCallErrorHandler passing LUA_NOREF.

References d_activeErrFuncIndex, d_activeErrFuncName, and d_errFuncIndex.

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.

Note:
  This function is really intended for use internally by other parts of the lua scripting support. Although it could be useful elsewhere for advanced uses, so long as you're careful!

References d_activeErrFuncIndex, d_activeErrFuncName, and d_errFuncName.

lua_State* CEGUI::LuaScriptModule::getLuaState | ( | void |  | ) | const`[inline]`

Method used to get a pointer to the lua_State that the script module is attached to.

Returns:
  A pointer to the lua_State that the script module is attached to.

lua_State* CEGUI::LuaScriptModule::getLuaState | ( | void |  | ) | const`[inline]`

Method used to get a pointer to the lua_State that the script module is attached to.

Returns:
  A pointer to the lua_State that the script module is attached to.

lua_State* CEGUI::LuaScriptModule::getLuaState | ( | void |  | ) | const`[inline]`

Method used to get a pointer to the lua_State that the script module is attached to.

Returns:
  A pointer to the lua_State that the script module is attached to.

lua_State* CEGUI::LuaScriptModule::getLuaState | ( | void |  | ) | const`[inline]`

Method used to get a pointer to the lua_State that the script module is attached to.

Returns:
  A pointer to the lua_State that the script module is attached to.

Referenced by orxonox::GUIManager::getLevelList(), orxonox::GUIManager::initialise(), and orxonox::GUIManager::loadLuaCode().

int CEGUI::LuaScriptModule::initErrorHandlerFunc | ( | int | func | ) | `[private]`

Init the error handler function. Return the lua stack index that should be passed to lua_pcall. NB: This should be called prior to pushing any function parameters onto the lua stack.

References d_activeErrFuncIndex, and d_state.

int CEGUI::LuaScriptModule::initErrorHandlerFunc | ( | const String | func_name | ) | `[private]`

Init the error handler function. Return the lua stack index that should be passed to lua_pcall. NB: This should be called prior to pushing any function parameters onto the lua stack.

References d_activeErrFuncName, d_state, and CEGUI::LuaFunctor::pushNamedFunction().

int CEGUI::LuaScriptModule::initErrorHandlerFunc | ( |  | ) | `[private]`

Init the error handler function. Return the lua stack index that should be passed to lua_pcall. NB: This should be called prior to pushing any function parameters onto the lua stack.

References d_activeErrFuncName, d_errFuncIndex, d_errFuncName, d_state, and CEGUI::LuaFunctor::pushNamedFunction().

Referenced by executeScriptedEventHandler(), executeScriptFile(), executeScriptGlobal(), and executeString().

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.

Parameters:

  | function_reference | Lua function registry index of the function to be called.

References d_errFuncIndex, d_errFuncName, and unrefErrorFunc().

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.

Parameters:

  | error_handler_function | Name of the lua function to be called. This is looked up / bound on first usage.

References d_errFuncIndex, d_errFuncName, and unrefErrorFunc().

void CEGUI::LuaScriptModule::setModuleIdentifierString | ( |  | ) | `[private]`

void CEGUI::LuaScriptModule::setModuleIdentifierString | ( |  | ) | `[private]`

void CEGUI::LuaScriptModule::setModuleIdentifierString | ( |  | ) | `[private]`

void CEGUI::LuaScriptModule::setModuleIdentifierString | ( |  | ) | `[private]`

Referenced by LuaScriptModule().

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.

Parameters:

  | 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.

Returns:
  Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.

References CEGUI::LuaFunctor::d_errFuncIndex, d_state, and CEGUI::LuaFunctor::index.

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.

Parameters:

  | 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.

Returns:
  Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.

References CEGUI::LuaFunctor::d_errFuncIndex, d_state, and CEGUI::LuaFunctor::index.

Event::Connection CEGUI::LuaScriptModule::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.

Parameters:

  | 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.

Returns:
  Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.

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.

Parameters:

  | 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.

Returns:
  Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.

References CEGUI::LuaFunctor::d_errFuncIndex, d_state, and CEGUI::LuaFunctor::index.

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.

Parameters:

  | 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.

Returns:
  Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.

References CEGUI::LuaFunctor::d_errFuncIndex, d_state, and CEGUI::LuaFunctor::index.

Event::Connection CEGUI::LuaScriptModule::subscribeEvent | ( | EventSet * | target,
|  | const String & | name,
|  | const String & | subscriber_name |
| ) |  |  |

Subscribes the named Event to a scripted funtion.

Parameters:

  | 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.

Returns:
  Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.

Event::Connection CEGUI::LuaScriptModule::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.

Parameters:

  | 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.

Returns:
  Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.

Exceptions:

  | UnknownObjectException | Thrown if an Event named name is not in the EventSet

Event::Connection CEGUI::LuaScriptModule::subscribeEvent | ( | EventSet * | target,
|  | const String & | name,
|  | const String & | subscriber_name |
| ) |  |  |

Subscribes the named Event to a scripted funtion.

Parameters:

  | 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.

Returns:
  Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.

Exceptions:

  | UnknownObjectException | Thrown if an Event named name is not in the EventSet

Event::Connection CEGUI::LuaScriptModule::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.

Parameters:

  | 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.

Returns:
  Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.

Exceptions:

  | UnknownObjectException | Thrown if an Event named name is not in the EventSet

Event::Connection CEGUI::LuaScriptModule::subscribeEvent | ( | EventSet * | target,
|  | const String & | name,
|  | const String & | subscriber_name |
| ) |  |  |

Subscribes the named Event to a scripted funtion.

Parameters:

  | 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.

Returns:
  Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.

Exceptions:

  | UnknownObjectException | Thrown if an Event named name is not in the EventSet

Event::Connection CEGUI::LuaScriptModule::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.

Parameters:

  | 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.

Returns:
  Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.

Exceptions:

  | UnknownObjectException | Thrown if an Event named name is not in the EventSet

References d_state.

Event::Connection CEGUI::LuaScriptModule::subscribeEvent | ( | EventSet * | target,
|  | const String & | name,
|  | const String & | subscriber_name |
| ) |  |  |

Subscribes the named Event to a scripted funtion.

Parameters:

  | 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.

Returns:
  Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.

Exceptions:

  | UnknownObjectException | Thrown if an Event named name is not in the EventSet

References d_state, and CEGUI::LuaFunctor::index.

void CEGUI::LuaScriptModule::unrefErrorFunc | ( |  | ) | `[private]`

release any reference we might have made to an error handling function.

References d_errFuncIndex, d_errFuncName, and d_state.

Referenced by setDefaultPCallErrorHandler().

## Member Data Documentation

int CEGUI::LuaScriptModule::d_activeErrFuncIndex`[private]`

Registry index of the function that is currently in use (as setup via a call to initErrorHandlerFunc)

Referenced by cleanupErrorHandlerFunc(), getActivePCallErrorHandlerReference(), getActivePCallErrorHandlerString(), and initErrorHandlerFunc().

String CEGUI::LuaScriptModule::d_activeErrFuncName`[private]`

Error handler function that is currently in use (as setup via a call to initErrorHandlerFunc)

Referenced by cleanupErrorHandlerFunc(), getActivePCallErrorHandlerReference(), getActivePCallErrorHandlerString(), and initErrorHandlerFunc().

int CEGUI::LuaScriptModule::d_errFuncIndex`[private]`

Default registry index of the function to pass to lua_pcall.

Referenced by getActivePCallErrorHandlerReference(), initErrorHandlerFunc(), setDefaultPCallErrorHandler(), and unrefErrorFunc().

String CEGUI::LuaScriptModule::d_errFuncName`[private]`

Default error handler function to pass to lua_pcall.

Referenced by getActivePCallErrorHandlerString(), initErrorHandlerFunc(), setDefaultPCallErrorHandler(), and unrefErrorFunc().

bool CEGUI::LuaScriptModule::d_ownsState`[private]`

true when the attached lua_State was created by this script module

Referenced by LuaScriptModule(), and ~LuaScriptModule().

lua_State * CEGUI::LuaScriptModule::d_state`[private]`

The lua_State that this script module uses.

Referenced by createBindings(), destroyBindings(), executeScriptedEventHandler(), executeScriptedEventHandler_impl(), executeScriptFile(), executeScriptFile_impl(), executeScriptGlobal(), executeScriptGlobal_impl(), executeString(), executeString_impl(), initErrorHandlerFunc(), LuaScriptModule(), subscribeEvent(), unrefErrorFunc(), and ~LuaScriptModule().

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

- src/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILua.h
- src/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILua.h
- src/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILua.h
- src/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILua.h
- src/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILua.cpp
- src/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILua.cpp
- src/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILua.cpp
- src/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILua.cpp