Add real v parameter to sim.partCreate

Currently it detects presence of v incorrectly (via if (ID(type))) and thus rewrites v = 0 to v = -1, even if 0 is actually what you want. Especially problematic if you're trying to spawn GOL (so LIFE(ctype=0)).
This commit is contained in:
Tamás Bálint Misius 2022-07-06 11:34:21 +02:00
parent 766ffd4ad6
commit ae253ebc75
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2

View File

@ -1031,7 +1031,11 @@ int LuaScriptInterface::simulation_partCreate(lua_State * l)
}
int type = lua_tointeger(l, 4);
int v = -1;
if (ID(type))
if (lua_gettop(l) >= 5)
{
v = lua_tointeger(l, 5);
}
else if (ID(type))
{
v = ID(type);
type = TYP(type);