summaryrefslogtreecommitdiff
path: root/src/script/common/c_content.cpp
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2015-05-16 12:26:57 -0400
committerkwolekr <kwolekr@minetest.net>2015-05-16 20:15:03 -0400
commitfb36c471d7c35bafec9c70028fbabf4ea4838ad2 (patch)
treea873df0cec3baa1342c39593f7977cb1700700f5 /src/script/common/c_content.cpp
parent8f9af57314f71aae1cc77e13f9996e13015d776d (diff)
downloadminetest-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/common/c_content.cpp')
-rw-r--r--src/script/common/c_content.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp
index 8f82b692a..c0728177f 100644
--- a/src/script/common/c_content.cpp
+++ b/src/script/common/c_content.cpp
@@ -162,18 +162,13 @@ void read_object_properties(lua_State *L, int index,
lua_pop(L, 1);
lua_getfield(L, -1, "colors");
- if(lua_istable(L, -1)){
- prop->colors.clear();
+ if (lua_istable(L, -1)) {
int table = lua_gettop(L);
- lua_pushnil(L);
- while(lua_next(L, table) != 0){
- // key at index -2 and value at index -1
- if(lua_isstring(L, -1))
- prop->colors.push_back(readARGB8(L, -1));
- else
- prop->colors.push_back(video::SColor(255, 255, 255, 255));
- // removes value, keeps key for next iteration
- lua_pop(L, 1);
+ prop->colors.clear();
+ for (lua_pushnil(L); lua_next(L, table); lua_pop(L, 1)) {
+ video::SColor color(255, 255, 255, 255);
+ read_color(L, -1, &color);
+ prop->colors.push_back(color);
}
}
lua_pop(L, 1);
@@ -357,8 +352,7 @@ ContentFeatures read_content_features(lua_State *L, int index)
/* Other stuff */
lua_getfield(L, index, "post_effect_color");
- if(!lua_isnil(L, -1))
- f.post_effect_color = readARGB8(L, -1);
+ read_color(L, -1, &f.post_effect_color);
lua_pop(L, 1);
f.param_type = (ContentParamType)getenumfield(L, index, "paramtype",