diff options
author | kwolekr <kwolekr@minetest.net> | 2015-05-16 12:26:57 -0400 |
---|---|---|
committer | kwolekr <kwolekr@minetest.net> | 2015-05-16 20:15:03 -0400 |
commit | fb36c471d7c35bafec9c70028fbabf4ea4838ad2 (patch) | |
tree | a873df0cec3baa1342c39593f7977cb1700700f5 /src/script/lua_api/l_object.cpp | |
parent | 8f9af57314f71aae1cc77e13f9996e13015d776d (diff) | |
download | minetest-fb36c471d7c35bafec9c70028fbabf4ea4838ad2.tar.gz minetest-fb36c471d7c35bafec9c70028fbabf4ea4838ad2.tar.bz2 minetest-fb36c471d7c35bafec9c70028fbabf4ea4838ad2.zip |
SAPI: Accept either ARGB8 table or ColorString to specify colors
Diffstat (limited to 'src/script/lua_api/l_object.cpp')
-rw-r--r-- | src/script/lua_api/l_object.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index 74903df5f..c83c8c747 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -1222,8 +1222,7 @@ int ObjectRef::l_set_sky(lua_State *L) return 0; video::SColor bgcolor(255,255,255,255); - if (!lua_isnil(L, 2)) - bgcolor = readARGB8(L, 2); + read_color(L, 2, &bgcolor); std::string type = luaL_checkstring(L, 3); @@ -1283,11 +1282,13 @@ int ObjectRef::l_set_nametag_attributes(lua_State *L) if (playersao == NULL) return 0; - video::SColor color = playersao->getNametagColor(); lua_getfield(L, 2, "color"); - if (!lua_isnil(L, -1)) - color = readARGB8(L, -1); - playersao->setNametagColor(color); + if (!lua_isnil(L, -1)) { + video::SColor color = playersao->getNametagColor(); + if (!read_color(L, -1, &color)) + return 0; + playersao->setNametagColor(color); + } lua_pushboolean(L, true); return 1; |