mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-07 08:56:30 +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);
|
int args = lua_gettop(l);
|
||||||
if(args)
|
if(args)
|
||||||
{
|
{
|
||||||
luaL_checktype(l, 1, LUA_TSTRING);
|
button->SetText(ByteString(luaL_checkstring(l, 1)).FromUtf8());
|
||||||
button->SetText(ByteString(lua_tostring(l, 1)).FromUtf8());
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -60,7 +60,7 @@ int LuaCheckbox::text(lua_State * l)
|
|||||||
int args = lua_gettop(l);
|
int args = lua_gettop(l);
|
||||||
if(args)
|
if(args)
|
||||||
{
|
{
|
||||||
checkbox->SetText(ByteString(lua_tostring(l, 1)).FromUtf8());
|
checkbox->SetText(ByteString(luaL_checkstring(l, 1)).FromUtf8());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -37,7 +37,7 @@ int LuaLabel::text(lua_State * l)
|
|||||||
int args = lua_gettop(l);
|
int args = lua_gettop(l);
|
||||||
if(args)
|
if(args)
|
||||||
{
|
{
|
||||||
label->SetText(ByteString(lua_tostring(l, 1)).FromUtf8());
|
label->SetText(ByteString(luaL_checkstring(l, 1)).FromUtf8());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -53,7 +53,7 @@ int LuaProgressBar::status(lua_State * l)
|
|||||||
int args = lua_gettop(l);
|
int args = lua_gettop(l);
|
||||||
if(args)
|
if(args)
|
||||||
{
|
{
|
||||||
progressBar->SetStatus(ByteString(lua_tostring(l, 1)).FromUtf8());
|
progressBar->SetStatus(ByteString(luaL_checkstring(l, 1)).FromUtf8());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -77,7 +77,7 @@ int LuaTextbox::text(lua_State * l)
|
|||||||
int args = lua_gettop(l);
|
int args = lua_gettop(l);
|
||||||
if(args)
|
if(args)
|
||||||
{
|
{
|
||||||
textbox->SetText(ByteString(lua_tostring(l, 1)).FromUtf8());
|
textbox->SetText(ByteString(luaL_checkstring(l, 1)).FromUtf8());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user