mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-01 06:00:15 +02:00
Fix exception when passing nil to some functions in interface api, fixes #849
This commit is contained in:
@@ -62,8 +62,7 @@ int LuaButton::text(lua_State * l)
|
||||
int args = lua_gettop(l);
|
||||
if(args)
|
||||
{
|
||||
luaL_checktype(l, 1, LUA_TSTRING);
|
||||
button->SetText(ByteString(lua_tostring(l, 1)).FromUtf8());
|
||||
button->SetText(ByteString(luaL_checkstring(l, 1)).FromUtf8());
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
@@ -60,7 +60,7 @@ int LuaCheckbox::text(lua_State * l)
|
||||
int args = lua_gettop(l);
|
||||
if(args)
|
||||
{
|
||||
checkbox->SetText(ByteString(lua_tostring(l, 1)).FromUtf8());
|
||||
checkbox->SetText(ByteString(luaL_checkstring(l, 1)).FromUtf8());
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
@@ -37,7 +37,7 @@ int LuaLabel::text(lua_State * l)
|
||||
int args = lua_gettop(l);
|
||||
if(args)
|
||||
{
|
||||
label->SetText(ByteString(lua_tostring(l, 1)).FromUtf8());
|
||||
label->SetText(ByteString(luaL_checkstring(l, 1)).FromUtf8());
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
@@ -53,7 +53,7 @@ int LuaProgressBar::status(lua_State * l)
|
||||
int args = lua_gettop(l);
|
||||
if(args)
|
||||
{
|
||||
progressBar->SetStatus(ByteString(lua_tostring(l, 1)).FromUtf8());
|
||||
progressBar->SetStatus(ByteString(luaL_checkstring(l, 1)).FromUtf8());
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
@@ -77,7 +77,7 @@ int LuaTextbox::text(lua_State * l)
|
||||
int args = lua_gettop(l);
|
||||
if(args)
|
||||
{
|
||||
textbox->SetText(ByteString(lua_tostring(l, 1)).FromUtf8());
|
||||
textbox->SetText(ByteString(luaL_checkstring(l, 1)).FromUtf8());
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
Reference in New Issue
Block a user