update entities.spawn(...) semantics to the docs state
This commit is contained in:
@@ -20,9 +20,12 @@ static int l_spawn(lua::State* L) {
|
||||
auto defname = lua::tostring(L, 1);
|
||||
auto& def = content->entities.require(defname);
|
||||
auto pos = lua::tovec3(L, 2);
|
||||
dynamic::Value args = dynamic::NONE;
|
||||
dynamic::Map_sptr args = nullptr;
|
||||
if (lua::gettop(L) > 2) {
|
||||
args = lua::tovalue(L, 3);
|
||||
auto value = lua::tovalue(L, 3);
|
||||
if (auto map = std::get_if<dynamic::Map_sptr>(&value)) {
|
||||
args = *map;
|
||||
}
|
||||
}
|
||||
level->entities->spawn(def, pos, args);
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user