Working
This commit is contained in:
22
luprex/syslua/globaldb.lua
Normal file
22
luprex/syslua/globaldb.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
local globaldb=class('globaldb')
|
||||
|
||||
function globaldb.get(db, key)
|
||||
local result = db[key]
|
||||
if type(result) == 'table' then
|
||||
return result
|
||||
else
|
||||
result = {}
|
||||
db[key] = result
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
function globaldb.accessor(db)
|
||||
return function(key)
|
||||
return globaldb.get(db, key)
|
||||
end
|
||||
end
|
||||
|
||||
function globaldb.create()
|
||||
return {}
|
||||
end
|
||||
Reference in New Issue
Block a user