Skip to content

Commit 7cf9722

Browse files
authored
add state query function
intending to modify state via the public API so it gets synced to cpp
1 parent ea65827 commit 7cf9722

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

plugins/lua/spectate.lua

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,18 @@ local function load_state()
8484
function() config_file:write() end
8585
end
8686

87-
-- global variables to make the UI script simpler
88-
_ENV.config, _ENV.save_state = load_state()
87+
local config, save_state = load_state()
88+
89+
-- called by gui/spectate
90+
function get_config_elem(name, key)
91+
local elem = config[name]
92+
if not elem then return end
93+
if type(elem) == 'table' then
94+
return elem[key]
95+
end
96+
return elem
97+
end
98+
8999

90100
function refresh_cpp_config()
91101
for name,value in pairs(config) do

0 commit comments

Comments
 (0)