add component ARGS variable

This commit is contained in:
MihailRis
2024-07-01 00:17:58 +03:00
parent da6b014d62
commit 1b41a75cf4
6 changed files with 24 additions and 7 deletions
+5 -1
View File
@@ -31,7 +31,11 @@ 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);
level->entities->spawn(def, pos);
dynamic::Value args = dynamic::NONE;
if (lua::gettop(L) > 2) {
args = lua::tovalue(L, 3);
}
level->entities->spawn(def, pos, args);
return 1;
}