diff --git a/Source/Lua/Elements/ElementTabSet.cpp b/Source/Lua/Elements/ElementTabSet.cpp index b4f5a903f..60b8f5aaa 100644 --- a/Source/Lua/Elements/ElementTabSet.cpp +++ b/Source/Lua/Elements/ElementTabSet.cpp @@ -38,7 +38,7 @@ namespace Lua { int ElementTabSetSetPanel(lua_State* L, ElementTabSet* obj) { RMLUI_CHECK_OBJ(obj); - int index = (int)luaL_checkinteger(L,1); + int index = GetIndex(L,1); const char* rml = luaL_checkstring(L,2); obj->SetPanel(index,rml); @@ -48,7 +48,7 @@ int ElementTabSetSetPanel(lua_State* L, ElementTabSet* obj) int ElementTabSetSetTab(lua_State* L, ElementTabSet* obj) { RMLUI_CHECK_OBJ(obj); - int index = (int)luaL_checkinteger(L,1); + int index = GetIndex(L,1); const char* rml = luaL_checkstring(L,2); obj->SetTab(index,rml); @@ -62,7 +62,7 @@ int ElementTabSetGetAttractive_tab(lua_State* L) ElementTabSet* obj = LuaType::check(L,1); RMLUI_CHECK_OBJ(obj); int tab = obj->GetActiveTab(); - lua_pushinteger(L,tab); + PushIndex(L,tab); return 1; } @@ -81,7 +81,7 @@ int ElementTabSetSetAttractive_tab(lua_State* L) { ElementTabSet* obj = LuaType::check(L,1); RMLUI_CHECK_OBJ(obj); - int tab = (int)luaL_checkinteger(L,2); + int tab = GetIndex(L,2); obj->SetActiveTab(tab); return 0; } diff --git a/Source/Lua/EventParametersProxy.cpp b/Source/Lua/EventParametersProxy.cpp index 0ee27e6fd..545b4bd52 100644 --- a/Source/Lua/EventParametersProxy.cpp +++ b/Source/Lua/EventParametersProxy.cpp @@ -55,7 +55,15 @@ int EventParametersProxy__index(lua_State* L) const char* key = lua_tostring(L,2); auto it = obj->owner->GetParameters().find(key); const Variant* param = (it == obj->owner->GetParameters().end() ? nullptr : &it->second); - PushVariant(L,param); + if (obj->owner->GetId() == EventId::Tabchange && + strcmp(key, "tab_index") == 0 && + param && + param->GetType() == Variant::Type::INT) + { + PushIndex(L,param->Get()); + } + else + PushVariant(L,param); return 1; } else