mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-02-07 00:41:26 +00:00
Merge branch 'lua-action-userdata-quickfix' into 'master'
Lua action userdata quickfix See merge request STJr/SRB2Internal!196
This commit is contained in:
commit
e5d16c520d
1 changed files with 7 additions and 7 deletions
|
@ -8869,17 +8869,17 @@ static int lib_getActionName(lua_State *L)
|
||||||
{
|
{
|
||||||
lua_settop(L, 1); // set top of stack to 1 (removing any extra args, which there shouldn't be)
|
lua_settop(L, 1); // set top of stack to 1 (removing any extra args, which there shouldn't be)
|
||||||
// get the name for this action, if possible.
|
// get the name for this action, if possible.
|
||||||
lua_getfield(gL, LUA_REGISTRYINDEX, LREG_ACTIONS);
|
lua_getfield(L, LUA_REGISTRYINDEX, LREG_ACTIONS);
|
||||||
lua_pushnil(gL);
|
lua_pushnil(L);
|
||||||
// Lua stack at this point:
|
// Lua stack at this point:
|
||||||
// 1 ... -2 -1
|
// 1 ... -2 -1
|
||||||
// arg ... LREG_ACTIONS nil
|
// arg ... LREG_ACTIONS nil
|
||||||
while (lua_next(gL, -2))
|
while (lua_next(L, -2))
|
||||||
{
|
{
|
||||||
// Lua stack at this point:
|
// Lua stack at this point:
|
||||||
// 1 ... -3 -2 -1
|
// 1 ... -3 -2 -1
|
||||||
// arg ... LREG_ACTIONS "A_ACTION" function
|
// arg ... LREG_ACTIONS "A_ACTION" function
|
||||||
if (lua_rawequal(gL, -1, 1)) // is this the same as the arg?
|
if (lua_rawequal(L, -1, 1)) // is this the same as the arg?
|
||||||
{
|
{
|
||||||
// make sure the key (i.e. "A_ACTION") is a string first
|
// make sure the key (i.e. "A_ACTION") is a string first
|
||||||
// (note: we don't use lua_isstring because it also returns true for numbers)
|
// (note: we don't use lua_isstring because it also returns true for numbers)
|
||||||
|
@ -8888,12 +8888,12 @@ static int lib_getActionName(lua_State *L)
|
||||||
lua_pushvalue(L, -2); // push "A_ACTION" string to top of stack
|
lua_pushvalue(L, -2); // push "A_ACTION" string to top of stack
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
lua_pop(gL, 2); // pop the name and function
|
lua_pop(L, 2); // pop the name and function
|
||||||
break; // probably should have succeeded but we didn't, so end the loop
|
break; // probably should have succeeded but we didn't, so end the loop
|
||||||
}
|
}
|
||||||
lua_pop(gL, 1);
|
lua_pop(L, 1);
|
||||||
}
|
}
|
||||||
lua_pop(gL, 1); // pop LREG_ACTIONS
|
lua_pop(L, 1); // pop LREG_ACTIONS
|
||||||
return 0; // return nothing (don't error)
|
return 0; // return nothing (don't error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue