Files
Elite-Gaming-FiveM/resources/cadvanced_mdt/client/state.lua
T
2021-12-03 01:19:31 +00:00

35 lines
615 B
Lua

state = {}
function state_init(key)
if not state[key] then
state[key] = {}
end
end
function state_get(key)
if not state[key] then
state_init(key)
end
return state[key]
end
function state_get_value(key, id)
if not state[key] then
return
end
local value = state[key]
for _, it in ipairs(value) do
if (it.id == id) then
return it
end
end
end
function state_set(key, val)
if not state[key] then
state_init(key)
end
print_debug("UPDATING STATE FOR " .. key)
state[key] = val
return state[key]
end