-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnoitaglobalstore.lua
More file actions
46 lines (37 loc) · 1018 Bytes
/
noitaglobalstore.lua
File metadata and controls
46 lines (37 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
stringstore.noita = stringstore.noita or {}
stringstore.noita.global = function(base_name)
GlobalsSetValue(base_name, "<managed by stringstore>")
return {
set_type = function(key, val)
GlobalsSetValue(base_name .. "." .. key .. ".type", val)
end,
set = function(key, val)
GlobalsSetValue(base_name .. "." .. key, val)
end,
get_type = function(key, val)
local stored_type = GlobalsGetValue(base_name .. "." .. key .. ".type")
if stored_type == "" then
return nil
else
return stored_type
end
end,
get = function(key)
return GlobalsGetValue(base_name .. "." .. key)
end,
get_sub_prefix = function(key)
return key .. ".idx."
end,
get_typed_key = function(key, type)
return key .. ":" .. type
end,
get_len_key = function(key)
return key .. ".len"
end,
restrict = function(key)
if key:find("\\.") or key:find(":") then
error("Cannot use the dot ('.') character or the colon character (':') in the Globals stringstore")
end
end
}
end