mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Rework of SPAWN
- Visible Array - Internal table in SPAWN GROUP functions - Route - RouteToZone - CopyRoute SPAWN functions - SpawnFromUnit - SpawnInZone Replaced SpawnFromCarrier overall
This commit is contained in:
@@ -66,41 +66,51 @@ routines.utils.oneLineSerialize = function(tbl) -- serialization of a table all
|
||||
tbl_str[#tbl_str + 1] = '{'
|
||||
|
||||
for ind,val in pairs(tbl) do -- serialize its fields
|
||||
local ind_str = {}
|
||||
if type(ind) == "number" then
|
||||
tbl_str[#tbl_str + 1] = '['
|
||||
tbl_str[#tbl_str + 1] = tostring(ind)
|
||||
tbl_str[#tbl_str + 1] = ']='
|
||||
ind_str[#ind_str + 1] = '['
|
||||
ind_str[#ind_str + 1] = tostring(ind)
|
||||
ind_str[#ind_str + 1] = ']='
|
||||
else --must be a string
|
||||
tbl_str[#tbl_str + 1] = '['
|
||||
tbl_str[#tbl_str + 1] = routines.utils.basicSerialize(ind)
|
||||
tbl_str[#tbl_str + 1] = ']='
|
||||
ind_str[#ind_str + 1] = '['
|
||||
ind_str[#ind_str + 1] = routines.utils.basicSerialize(ind)
|
||||
ind_str[#ind_str + 1] = ']='
|
||||
end
|
||||
|
||||
local val_str = {}
|
||||
if ((type(val) == 'number') or (type(val) == 'boolean')) then
|
||||
tbl_str[#tbl_str + 1] = tostring(val)
|
||||
tbl_str[#tbl_str + 1] = ','
|
||||
elseif type(val) == 'string' then
|
||||
tbl_str[#tbl_str + 1] = routines.utils.basicSerialize(val)
|
||||
tbl_str[#tbl_str + 1] = ','
|
||||
val_str[#val_str + 1] = tostring(val)
|
||||
val_str[#val_str + 1] = ','
|
||||
tbl_str[#tbl_str + 1] = table.concat(ind_str)
|
||||
tbl_str[#tbl_str + 1] = table.concat(val_str)
|
||||
elseif type(val) == 'string' then
|
||||
val_str[#val_str + 1] = routines.utils.basicSerialize(val)
|
||||
val_str[#val_str + 1] = ','
|
||||
tbl_str[#tbl_str + 1] = table.concat(ind_str)
|
||||
tbl_str[#tbl_str + 1] = table.concat(val_str)
|
||||
elseif type(val) == 'nil' then -- won't ever happen, right?
|
||||
tbl_str[#tbl_str + 1] = 'nil,'
|
||||
val_str[#val_str + 1] = 'nil,'
|
||||
tbl_str[#tbl_str + 1] = table.concat(ind_str)
|
||||
tbl_str[#tbl_str + 1] = table.concat(val_str)
|
||||
elseif type(val) == 'table' then
|
||||
if ind == "__index" then
|
||||
tbl_str[#tbl_str + 1] = "__index"
|
||||
tbl_str[#tbl_str + 1] = ',' --I think this is right, I just added it
|
||||
-- tbl_str[#tbl_str + 1] = "__index"
|
||||
-- tbl_str[#tbl_str + 1] = ',' --I think this is right, I just added it
|
||||
else
|
||||
|
||||
tbl_str[#tbl_str + 1] = _Serialize(val)
|
||||
tbl_str[#tbl_str + 1] = ',' --I think this is right, I just added it
|
||||
val_str[#val_str + 1] = _Serialize(val)
|
||||
val_str[#val_str + 1] = ',' --I think this is right, I just added it
|
||||
tbl_str[#tbl_str + 1] = table.concat(ind_str)
|
||||
tbl_str[#tbl_str + 1] = table.concat(val_str)
|
||||
end
|
||||
elseif type(val) == 'function' then
|
||||
tbl_str[#tbl_str + 1] = "function " .. tostring(ind)
|
||||
tbl_str[#tbl_str + 1] = ',' --I think this is right, I just added it
|
||||
-- tbl_str[#tbl_str + 1] = "function " .. tostring(ind)
|
||||
-- tbl_str[#tbl_str + 1] = ',' --I think this is right, I just added it
|
||||
else
|
||||
env.info('unable to serialize value type ' .. routines.utils.basicSerialize(type(val)) .. ' at index ' .. tostring(ind))
|
||||
env.info( debug.traceback() )
|
||||
-- env.info('unable to serialize value type ' .. routines.utils.basicSerialize(type(val)) .. ' at index ' .. tostring(ind))
|
||||
-- env.info( debug.traceback() )
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
tbl_str[#tbl_str + 1] = '}'
|
||||
return table.concat(tbl_str)
|
||||
|
||||
Reference in New Issue
Block a user