mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-23 00:40:04 +00:00
[lua] Fix some Dialog functions to convert to string implicitly
This commit is contained in:
parent
3cd97c9822
commit
8d8c116fa8
@ -300,7 +300,7 @@ int Dialog_add_widget(lua_State* L, Widget* widget)
|
||||
|
||||
// Label
|
||||
type = lua_getfield(L, 2, "label");
|
||||
if (type == LUA_TSTRING)
|
||||
if (type != LUA_TNIL)
|
||||
label = lua_tostring(L, -1);
|
||||
lua_pop(L, 1);
|
||||
|
||||
@ -374,7 +374,7 @@ int Dialog_label(lua_State* L)
|
||||
std::string text;
|
||||
if (lua_istable(L, 2)) {
|
||||
int type = lua_getfield(L, 2, "text");
|
||||
if (type == LUA_TSTRING) {
|
||||
if (type != LUA_TNIL) {
|
||||
if (auto p = lua_tostring(L, -1))
|
||||
text = p;
|
||||
}
|
||||
@ -391,7 +391,7 @@ int Dialog_button_base(lua_State* L, T** outputWidget = nullptr)
|
||||
std::string text;
|
||||
if (lua_istable(L, 2)) {
|
||||
int type = lua_getfield(L, 2, "text");
|
||||
if (type == LUA_TSTRING) {
|
||||
if (type != LUA_TNIL) {
|
||||
if (auto p = lua_tostring(L, -1))
|
||||
text = p;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user