diff options
Diffstat (limited to 'src/script/lua_api')
-rw-r--r-- | src/script/lua_api/luaapi.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/script/lua_api/luaapi.cpp b/src/script/lua_api/luaapi.cpp index 020d1cf32..0d4c7da7b 100644 --- a/src/script/lua_api/luaapi.cpp +++ b/src/script/lua_api/luaapi.cpp @@ -672,7 +672,6 @@ int ModApiBasic::l_register_ore(lua_State *L) ore->ore_name = getstringfield_default(L, index, "ore", ""); ore->ore_param2 = (u8)getintfield_default(L, index, "ore_param2", 0); - ore->wherein_name = getstringfield_default(L, index, "wherein", ""); ore->clust_scarcity = getintfield_default(L, index, "clust_scarcity", 1); ore->clust_num_ores = getintfield_default(L, index, "clust_num_ores", 1); ore->clust_size = getintfield_default(L, index, "clust_size", 0); @@ -681,6 +680,21 @@ int ModApiBasic::l_register_ore(lua_State *L) ore->flags = getflagsfield(L, index, "flags", flagdesc_ore); ore->nthresh = getfloatfield_default(L, index, "noise_threshhold", 0.); + lua_getfield(L, index, "wherein"); + if (lua_istable(L, -1)) { + int i = lua_gettop(L); + lua_pushnil(L); + while(lua_next(L, i) != 0) { + ore->wherein_names.push_back(lua_tostring(L, -1)); + lua_pop(L, 1); + } + } else if (lua_isstring(L, -1)) { + ore->wherein_names.push_back(lua_tostring(L, -1)); + } else { + ore->wherein_names.push_back(""); + } + lua_pop(L, 1); + lua_getfield(L, index, "noise_params"); ore->np = read_noiseparams(L, -1); lua_pop(L, 1); |