mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-11 17:49:53 -10:00
Fix HookVariables-related stuff, and add errors in case it ever gets broken again.
git-svn-id: svn://svn.icculus.org/fs2open/trunk/fs2_open@3912 387891d4-d844-0410-90c0-e4c51a9137d3
This commit is contained in:
1 parent
6a0bdcb8c7
commit
a3ec50ee2c
2 files changed
+97
-16
No files matched your search
@@ -332,7 +332,7 @@ void script_state::SetHookVar(char *name, char format, void *data)
|
||||
return;
|
||||
|
||||
//Get ScriptVar table
|
||||
lua_pushliteral(LuaState, "sv");
|
||||
lua_pushliteral(LuaState, "hv");
|
||||
lua_gettable(LuaState, LUA_GLOBALSINDEX);
|
||||
int sv_ldx = lua_gettop(LuaState);
|
||||
if(lua_isuserdata(LuaState, sv_ldx))
|
||||
@@ -371,6 +371,10 @@ void script_state::SetHookVar(char *name, char format, void *data)
|
||||
}
|
||||
lua_pop(LuaState, 1); //Metatable
|
||||
}
|
||||
else
|
||||
{
|
||||
LuaError(LuaState, "Could not get HookVariable library to set hook variable '%s' - get a coder", name);
|
||||
}
|
||||
lua_pop(LuaState, 1); //Library
|
||||
|
||||
if(data_ldx)
|
||||
@@ -390,7 +394,7 @@ bool script_state::GetHookVar(char *name, char format, void *data)
|
||||
//WMC - Quick and clean. :)
|
||||
//WMC - *sigh* nostalgia
|
||||
//Get ScriptVar table
|
||||
lua_pushliteral(LuaState, "sv");
|
||||
lua_pushliteral(LuaState, "hv");
|
||||
lua_gettable(LuaState, LUA_GLOBALSINDEX);
|
||||
int sv_ldx = lua_gettop(LuaState);
|
||||
if(lua_isuserdata(LuaState, sv_ldx))
|
||||
@@ -421,6 +425,10 @@ bool script_state::GetHookVar(char *name, char format, void *data)
|
||||
}
|
||||
lua_pop(LuaState, 1); //Metatable
|
||||
}
|
||||
else
|
||||
{
|
||||
LuaError(LuaState, "Could not get HookVariable library to get hook variable '%' - get a coder", name);
|
||||
}
|
||||
lua_pop(LuaState, 1); //Library
|
||||
}
|
||||
|
||||
@@ -434,7 +442,7 @@ void script_state::RemHookVar(char *name)
|
||||
//WMC - Quick and clean. :)
|
||||
//WMC - *sigh* nostalgia
|
||||
//Get ScriptVar table
|
||||
lua_pushliteral(LuaState, "sv");
|
||||
lua_pushliteral(LuaState, "hv");
|
||||
lua_gettable(LuaState, LUA_GLOBALSINDEX);
|
||||
int sv_ldx = lua_gettop(LuaState);
|
||||
if(lua_isuserdata(LuaState, sv_ldx))
|
||||
@@ -458,6 +466,10 @@ void script_state::RemHookVar(char *name)
|
||||
}
|
||||
lua_pop(LuaState, 1); //Metatable
|
||||
}
|
||||
else
|
||||
{
|
||||
LuaError(LuaState, "Could not get HookVariable library to remove hook variable '%s' - get a coder", name);
|
||||
}
|
||||
lua_pop(LuaState, 1); //Library
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user