mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-31 21:01:39 +09:00
Change to uuid system
This commit is contained in:
@@ -21,6 +21,7 @@ local module_verbose = false --true|false
|
|||||||
-- @field named a name index for thread uuids
|
-- @field named a name index for thread uuids
|
||||||
-- @field print_to contains players that event details will be printed to
|
-- @field print_to contains players that event details will be printed to
|
||||||
-- @field uuid contains the random number generator for the uuid system
|
-- @field uuid contains the random number generator for the uuid system
|
||||||
|
local pre_load_uuid = 0
|
||||||
local global = global{
|
local global = global{
|
||||||
all={_n=0},
|
all={_n=0},
|
||||||
queue={},
|
queue={},
|
||||||
@@ -38,12 +39,20 @@ local global = global{
|
|||||||
-- @treturn string the new uuid
|
-- @treturn string the new uuid
|
||||||
Server.uuid = add_metatable({},function()
|
Server.uuid = add_metatable({},function()
|
||||||
-- when it is called as a function
|
-- when it is called as a function
|
||||||
|
local uuid = 0
|
||||||
|
if game then
|
||||||
global.uuid=global.uuid+1
|
global.uuid=global.uuid+1
|
||||||
verbose('UUID Created: '..global.uuid)
|
uuid=global.uuid+pre_load_uuid
|
||||||
return global.uuid
|
verbose('Game UUID Increased: '..uuid)
|
||||||
|
else
|
||||||
|
pre_load_uuid=pre_load_uuid+1
|
||||||
|
uuid=pre_load_uuid
|
||||||
|
verbose('Load UUID Increased: '..uuid)
|
||||||
|
end
|
||||||
|
return add_metatable({uuid},nil,function(tbl) return string.to_hex(tostring(tbl[1])) end)
|
||||||
end,function()
|
end,function()
|
||||||
-- when it is treated as a string
|
-- when it is treated as a string
|
||||||
return string.to_hex(tostring(Server.uuid()))
|
return tostring(Server.uuid())
|
||||||
end)
|
end)
|
||||||
|
|
||||||
--- Redirect to the thread index
|
--- Redirect to the thread index
|
||||||
|
|||||||
Reference in New Issue
Block a user