UFO: Alien Invasion
Loading...
Searching...
No Matches
cl_lua.h File Reference
#include "../../common/scripts_lua.h"
Include dependency graph for cl_lua.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

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

Function Documentation

◆ CL_ExecuteCallback()

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 194 of file cl_lua.cpp.

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

Referenced by UI_CallHandler_OnLoad().

◆ CL_GetLuaState()

◆ CL_InitLua()

◆ CL_RegisterCallback()

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 175 of file cl_lua.cpp.

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

Referenced by UI_RegisterHandler_OnLoad().

◆ CL_ShutdownLua()

void CL_ShutdownLua ( void )

Shutdown the ui-lua interfacing environment.

Definition at line 155 of file cl_lua.cpp.

References cl_callback, cl_luastate, and HASH_DeleteTable().

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