mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-22 02:42:20 +00:00
Merge branch 'fix-lua-consvars-with-functions' into 'next'
Fix CV_RegisterVar returning LUA_GetErrorMessage to Lua when CV_CALL is involved. (Resolves #403) Closes #403 See merge request STJr/SRB2!1346
This commit is contained in:
commit
52c96239ba
1 changed files with 2 additions and 1 deletions
|
@ -285,8 +285,8 @@ static void Lua_OnChange(void)
|
|||
|
||||
/// \todo Network this! XD_LUAVAR
|
||||
|
||||
lua_settop(gL, 0); // Just in case...
|
||||
lua_pushcfunction(gL, LUA_GetErrorMessage);
|
||||
lua_insert(gL, 1); // Because LUA_Call wants it at index 1.
|
||||
|
||||
// From CV_OnChange registry field, get the function for this cvar by name.
|
||||
lua_getfield(gL, LUA_REGISTRYINDEX, "CV_OnChange");
|
||||
|
@ -301,6 +301,7 @@ static void Lua_OnChange(void)
|
|||
|
||||
LUA_Call(gL, 1, 0, 1); // call function(cvar)
|
||||
lua_pop(gL, 1); // pop CV_OnChange table
|
||||
lua_remove(gL, 1); // remove LUA_GetErrorMessage
|
||||
}
|
||||
|
||||
static int lib_cvRegisterVar(lua_State *L)
|
||||
|
|
Loading…
Reference in a new issue