UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cl_lua.h File Reference
#include "../../common/scripts_lua.h"

Go to the source code of this file.

Functions

void CL_InitLua (void)
 Initializes the ui-lua interfacing environment. More...
 
void CL_ShutdownLua (void)
 Shutdown the ui-lua interfacing environment. More...
 
lua_State * CL_GetLuaState (void)
 Returns the lua state for the client side. More...
 
void CL_RegisterCallback (const char *key, LUA_FUNCTION fnc)
 Registers a lua callback function with a key. More...
 
void CL_ExecuteCallback (lua_State *L, const char *key)
 Calls the registered lua onload callback function. More...
 

Function Documentation

void CL_ExecuteCallback ( lua_State *  L,
const char *  key 
)

Calls the registered lua onload callback function.

Parameters
[in]LThe lua state for calling lua.
[in]keyscript The name of the .ufo file holding the lua script.
Note
The signature of the lua function is without any paramters: function ().
If the signature changes, this function should change too.

Definition at line 190 of file cl_lua.cpp.

References cl_luastate, Com_Printf(), and HASH_Get().

Referenced by UI_CallHandler_OnLoad().

void CL_RegisterCallback ( const char *  key,
LUA_FUNCTION  fnc 
)

Registers a lua callback function with a key.

Parameters
keyA key for finding the callback function by name, usually the script name.
fncA lua function registered in the lua registry index.

Definition at line 171 of file cl_lua.cpp.

References Com_Printf(), HASH_Insert(), int(), and len.

Referenced by UI_RegisterHandler_OnLoad().

void CL_ShutdownLua ( void  )

Shutdown the ui-lua interfacing environment.

Definition at line 151 of file cl_lua.cpp.

References cl_luastate, and HASH_DeleteTable().

Referenced by CL_InitLua(), CL_Shutdown(), and TEST_Shutdown().