From a091f55fec5c19ab6c31accb9b13510d74855169 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Sat, 16 Feb 2013 14:52:29 +0000 Subject: [PATCH] Allow implicit conversions when setting text property on some Lua API UI elements --- src/cat/LuaCheckbox.cpp | 2 -- src/cat/LuaLabel.cpp | 3 +-- src/cat/LuaTextbox.cpp | 3 +-- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/cat/LuaCheckbox.cpp b/src/cat/LuaCheckbox.cpp index 844573eac..8256730b6 100644 --- a/src/cat/LuaCheckbox.cpp +++ b/src/cat/LuaCheckbox.cpp @@ -53,7 +53,6 @@ int LuaCheckbox::checked(lua_State * l) int args = lua_gettop(l); if(args) { - luaL_checktype(l, 1, LUA_TBOOLEAN); checkbox->SetChecked(lua_toboolean(l, 1)); return 0; } @@ -84,7 +83,6 @@ int LuaCheckbox::text(lua_State * l) int args = lua_gettop(l); if(args) { - luaL_checktype(l, 1, LUA_TSTRING); checkbox->SetText(lua_tostring(l, 1)); return 0; } diff --git a/src/cat/LuaLabel.cpp b/src/cat/LuaLabel.cpp index e2ca56db2..007e00973 100644 --- a/src/cat/LuaLabel.cpp +++ b/src/cat/LuaLabel.cpp @@ -40,8 +40,7 @@ int LuaLabel::text(lua_State * l) int args = lua_gettop(l); if(args) { - luaL_checktype(l, 1, LUA_TSTRING); - label->SetText(lua_tostring(l, 1)); + label->SetText(std::string(lua_tostring(l, 1))); return 0; } else diff --git a/src/cat/LuaTextbox.cpp b/src/cat/LuaTextbox.cpp index fa5753c95..46285c8d9 100644 --- a/src/cat/LuaTextbox.cpp +++ b/src/cat/LuaTextbox.cpp @@ -100,8 +100,7 @@ int LuaTextbox::text(lua_State * l) int args = lua_gettop(l); if(args) { - luaL_checktype(l, 1, LUA_TSTRING); - textbox->SetText(lua_tostring(l, 1)); + textbox->SetText(std::string(lua_tostring(l, 1))); return 0; } else