UFO: Alien Invasion
|
Basic lua initialization for the client. More...
#include "cl_lua.h"
#include "../../shared/cxx.h"
#include "../../shared/defines.h"
#include "../../shared/shared.h"
#include "../../common/hashtable.h"
#include "../../common/filesys.h"
Go to the source code of this file.
Functions | |
int | luaopen_ufo (lua_State *L) |
static int | CL_UfoModuleLoader (lua_State *L) |
Loader that enables the lua files to access .ufo files through the ufo filesystem. More... | |
static void | CL_InsertModuleLoader (lua_State *L) |
This function adds loader to the lua table of module loaders that enables lua to access the ufo filesystem. More... | |
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... | |
Variables | |
lua_State * | cl_luastate = nullptr |
hashTable_s * | cl_callback = nullptr |
Basic lua initialization for the client.
Definition in file cl_lua.cpp.
void CL_ExecuteCallback | ( | lua_State * | L, |
const char * | key | ||
) |
Calls the registered lua onload callback function.
[in] | L | The lua state for calling lua. |
[in] | key | script The name of the .ufo file holding the lua script. |
Definition at line 190 of file cl_lua.cpp.
References cl_luastate, Com_Printf(), and HASH_Get().
Referenced by UI_CallHandler_OnLoad().
lua_State* CL_GetLuaState | ( | void | ) |
Returns the lua state for the client side.
Definition at line 162 of file cl_lua.cpp.
References cl_luastate.
Referenced by UI_ExecuteLuaConFunc(), UI_ExecuteLuaEventScript(), UI_ExecuteLuaEventScript_DragDrop(), UI_ExecuteLuaEventScript_DragDrop_IsDropped(), UI_ExecuteLuaEventScript_DragDrop_XY(), UI_ExecuteLuaEventScript_DxDy(), UI_ExecuteLuaEventScript_Key(), UI_ExecuteLuaEventScript_ParamList(), UI_ExecuteLuaEventScript_ReturnBool(), UI_ExecuteLuaEventScript_XY(), UI_ExecuteLuaMethod(), and UI_ParseAndLoadLuaScript().
Initializes the ui-lua interfacing environment.
Definition at line 126 of file cl_lua.cpp.
References CL_InsertModuleLoader(), cl_luastate, CL_ShutdownLua(), HASH_NewTable(), and luaopen_ufo().
Referenced by CL_Init(), UILevel2Test::SetUpTestCase(), ParticleTest::SetUpTestCase(), ScriptTest::SetUpTestCase(), FootStepTest::SetUpTestCase(), MapDefStatsTest::SetUpTestCase(), MapDefTest::SetUpTestCase(), MapDefMassRMATest::SetUpTestCase(), and CampaignTest::SetUpTestCase().
|
static |
This function adds loader to the lua table of module loaders that enables lua to access the ufo filesystem.
Definition at line 87 of file cl_lua.cpp.
References CL_UfoModuleLoader().
Referenced by CL_InitLua().
void CL_RegisterCallback | ( | const char * | key, |
LUA_FUNCTION | fnc | ||
) |
Registers a lua callback function with a key.
key | A key for finding the callback function by name, usually the script name. |
fnc | A 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().
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().
|
static |
Loader that enables the lua files to access .ufo files through the ufo filesystem.
Definition at line 47 of file cl_lua.cpp.
References Com_sprintf(), FS_LoadFile(), len, and name.
Referenced by CL_InsertModuleLoader().
int luaopen_ufo | ( | lua_State * | L | ) |
Referenced by CL_InitLua().
hashTable_s* cl_callback = nullptr |
Definition at line 37 of file cl_lua.cpp.
lua_State* cl_luastate = nullptr |
Definition at line 35 of file cl_lua.cpp.
Referenced by CL_ExecuteCallback(), CL_GetLuaState(), CL_InitLua(), and CL_ShutdownLua().