diff options
author | Samuel Barney <samjbarney@gmail.com> | 2015-08-07 16:44:52 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-08-07 21:17:21 +0200 |
commit | 4996e53bf53ae63b569941f322250ccf98781ace (patch) | |
tree | 25d201467d174cff26daff5fb073829f91a0f302 /src/Bindings/ManualBindings.cpp | |
parent | Merge pull request #2415 from nichwall/master (diff) | |
download | cuberite-4996e53bf53ae63b569941f322250ccf98781ace.tar cuberite-4996e53bf53ae63b569941f322250ccf98781ace.tar.gz cuberite-4996e53bf53ae63b569941f322250ccf98781ace.tar.bz2 cuberite-4996e53bf53ae63b569941f322250ccf98781ace.tar.lz cuberite-4996e53bf53ae63b569941f322250ccf98781ace.tar.xz cuberite-4996e53bf53ae63b569941f322250ccf98781ace.tar.zst cuberite-4996e53bf53ae63b569941f322250ccf98781ace.zip |
Diffstat (limited to 'src/Bindings/ManualBindings.cpp')
-rw-r--r-- | src/Bindings/ManualBindings.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/Bindings/ManualBindings.cpp b/src/Bindings/ManualBindings.cpp index 4260d33c7..b4d5449b5 100644 --- a/src/Bindings/ManualBindings.cpp +++ b/src/Bindings/ManualBindings.cpp @@ -1313,23 +1313,27 @@ static int tolua_SetObjectCallback(lua_State * tolua_S) static int tolua_cPluginLua_AddWebTab(lua_State * tolua_S) { - cPluginLua * self = reinterpret_cast<cPluginLua *>(tolua_tousertype(tolua_S, 1, nullptr)); + cLuaState LuaState(tolua_S); + cPluginLua * self = nullptr; + if (!LuaState.GetStackValue(1, self)) + { + LOGWARNING("cPluginLua:AddWebTab: invalid self as first argument"); + return 0; + } + tolua_Error tolua_err; tolua_err.array = 0; tolua_err.index = 3; tolua_err.type = "function"; - std::string Title = ""; + std::string Title; int Reference = LUA_REFNIL; - if ( - tolua_isstring(tolua_S, 2, 0, &tolua_err) && - lua_isfunction(tolua_S, 3) - ) + if (LuaState.CheckParamString(2) && LuaState.CheckParamFunction(3)) { Reference = luaL_ref(tolua_S, LUA_REGISTRYINDEX); - Title = (static_cast<std::string>(tolua_tocppstring(tolua_S, 2, 0))); + LuaState.GetStackValue(2, Title); } else { |