mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-31 04:51:40 +09:00
Fixed table.json
This commit is contained in:
@@ -35,15 +35,15 @@ local global = global{
|
|||||||
time_period={18000,'5.00M'},
|
time_period={18000,'5.00M'},
|
||||||
game_speed=1.0,
|
game_speed=1.0,
|
||||||
players={
|
players={
|
||||||
online={'Offline'},
|
online={},
|
||||||
n_online=0,
|
n_online=0,
|
||||||
all={'Offline'},
|
all={},
|
||||||
n_all=0,
|
n_all=0,
|
||||||
admins_online=0,
|
admins_online=0,
|
||||||
afk_players={},
|
afk_players={},
|
||||||
times={'Offline'}
|
times={}
|
||||||
},
|
},
|
||||||
ranks={'Offline'},
|
roles={admin={online={},players={},n_online=0,n_players=0},user={online={},players={},n_online=0,n_players=0}},
|
||||||
rockets=0,
|
rockets=0,
|
||||||
mods={'Offline'}
|
mods={'Offline'}
|
||||||
}
|
}
|
||||||
@@ -242,6 +242,15 @@ Sync.info = setmetatable({},{
|
|||||||
if type(v) ~= nil then return k,v end
|
if type(v) ~= nil then return k,v end
|
||||||
end
|
end
|
||||||
return next_pair, tbl, nil
|
return next_pair, tbl, nil
|
||||||
|
end,
|
||||||
|
__ipairs=function(tbl)
|
||||||
|
local tbl = global
|
||||||
|
local function next_pair(tbl, i)
|
||||||
|
i = i + 1
|
||||||
|
local v = tbl[i]
|
||||||
|
if v then return i, v end
|
||||||
|
end
|
||||||
|
return next_pair, tbl, 0
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -263,7 +272,7 @@ function Sync.update()
|
|||||||
afk_players=Sync.count_afk_times(),
|
afk_players=Sync.count_afk_times(),
|
||||||
times=Sync.count_player_times()
|
times=Sync.count_player_times()
|
||||||
}
|
}
|
||||||
info.ranks = Sync.count_roles()
|
info.roles = Sync.count_roles()
|
||||||
info.rockets = game.forces['player'].get_item_launched('satellite')
|
info.rockets = game.forces['player'].get_item_launched('satellite')
|
||||||
for key,callback in pairs(Sync_updates) do info[key] = callback() end
|
for key,callback in pairs(Sync_updates) do info[key] = callback() end
|
||||||
return info
|
return info
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ function table.json(lua_table)
|
|||||||
for key,value in ipairs(lua_table) do
|
for key,value in ipairs(lua_table) do
|
||||||
done[key] = true
|
done[key] = true
|
||||||
if type(value) == 'table' then table.insert(result,table.json(value,true))
|
if type(value) == 'table' then table.insert(result,table.json(value,true))
|
||||||
elseif not vlaue then table.insert(result,'null')
|
elseif not value then table.insert(result,'null')
|
||||||
else table.insert(result,table.val_to_str(value))
|
else table.insert(result,table.val_to_str(value))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user