Interface for the LuaScriptModule class.
More...
+ Inheritance diagram for CEGUI::LuaScriptModule:
+ Collaboration diagram for CEGUI::LuaScriptModule:
Public Member Functions
Execute a scripted global function. The function should not take any parameters and should return an integer.
More...
Execute a scripted global function. The function should not take any parameters and should return an integer.
More...
Execute a scripted global function. The function should not take any parameters and should return an integer.
More...
Execute a scripted global 'event handler' function by looking it up by name.
More...
Execute a scripted global 'event handler' function by looking it up by name.
More...
Execute a scripted global 'event handler' function by looking it up by name.
More...
Subscribes the specified group of the named
Event to a scripted funtion.
More...
Subscribes the specified group of the named
Event to a scripted funtion.
More...
Subscribes the specified group of the named
Event to a scripted funtion.
More...
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...
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...
Method used to get a pointer to the lua_State that the script module is attached to.
More...
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...
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...
Return the function name string of the active error handler function.
More...
return the lua registry index of the active error handler function.
More...
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...
Static Public Member Functions
Sets the default resource group to be used when loading script files.
More...
Returns the default resource group used when loading script files.
More...
Additional Inherited Members
String that holds some id information about the module.
holds the default resource group ID for loading script files.
Detailed Description
Member Function Documentation
static
LuaScriptModule& CEGUI::LuaScriptModule::create
(
lua_State *
state =
0
)
static
Creates a LuaScriptModule object.
- Parameters
-
state Pointer to the lua_State that the script module should attach to, if this is 0 a lua_State will be created.
void CEGUI::LuaScriptModule::createBindings
(
void
)
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.
- Returns
- Nothing.
Reimplemented from CEGUI::ScriptModule.
void CEGUI::LuaScriptModule::destroyBindings
(
void
)
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.
- Returns
- Nothing.
Reimplemented from CEGUI::ScriptModule.
bool CEGUI::LuaScriptModule::executeScriptedEventHandler
(
const
String &
handler_name,
)
virtual
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.
Implements CEGUI::ScriptModule.
bool CEGUI::LuaScriptModule::executeScriptedEventHandler
(
const
String &
handler_name,
)
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.
bool CEGUI::LuaScriptModule::executeScriptedEventHandler
(
const
String &
handler_name,
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.
void CEGUI::LuaScriptModule::executeScriptFile
(
const
String &
filename,
)
virtual
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.
Implements CEGUI::ScriptModule.
void CEGUI::LuaScriptModule::executeScriptFile
(
const
String &
filename,
)
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.
void CEGUI::LuaScriptModule::executeScriptFile
(
const
String &
filename,
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.
int CEGUI::LuaScriptModule::executeScriptGlobal
(
const
String &
function_name )
virtual
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.
Implements CEGUI::ScriptModule.
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.
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.
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.
void CEGUI::LuaScriptModule::executeString
(
const
String &
str )
virtual
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.
Implements CEGUI::ScriptModule.
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.
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.
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.
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.
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!
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.
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.
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.
const
String &
subscriber_name
)
virtual
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.
Implements CEGUI::ScriptModule.
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.
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.
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.
const
String &
subscriber_name
)
virtual
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.
Implements CEGUI::ScriptModule.
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.
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.
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.