File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -84,7 +84,8 @@ local function load_state()
8484 function () config_file :write () end
8585end
8686
87- local config , save_state = load_state ()
87+ -- global variables to make the UI script simpler
88+ _ENV .config , _ENV .save_state = load_state ()
8889
8990function refresh_cpp_config ()
9091 for name ,value in pairs (config ) do
@@ -158,11 +159,15 @@ local function do_toggle()
158159end
159160
160161local function set_setting (args )
162+ local n = # args
163+ if n == 0 then
164+ qerror (' missing key' )
165+ end
161166 local key = table.remove (args , 1 )
162167 if config [key ] == nil then
163168 qerror (' unknown setting: ' .. key )
164169 end
165- local n = # args
170+ n = # args
166171 if n == 0 then
167172 qerror (' missing value' )
168173 end
@@ -221,6 +226,7 @@ function parse_commandline(args)
221226 elseif command == ' set' then
222227 set_setting (args )
223228 elseif command == ' overlay' then
229+ if # args == 0 then qerror (' missing option' ) end
224230 set_overlay (args [1 ])
225231 else
226232 return false
You can’t perform that action at this time.
0 commit comments