__SYMBOLS = { }; __DICT = { }; -- the keys will be strings (the commands), and values will be true local function onAutoAssemble(script,syntax) local multiline_comment = false; for i = 0,script.count - 1 do local line = script[i]; if multiline_comment then if line:find'}' then multiline_comment = false; end else if line:find'^registersymbol%(' then local command = 'un'..line:match'^registersymbol%(.-%)'; if not __DICT[command] then -- the command isn't in the list yet __SYMBOLS[#__SYMBOLS + 1] = command; __DICT[command] = true; -- now it is end elseif line:find'^unregistersymbol%(' then local command = line:match'^unregistersymbol%(.-%)'; __DICT[command] = nil; -- remove command from the list for i,v in ipairs(__SYMBOLS) do if v == command then table.remove(__SYMBOLS,i); -- also remove it from __SYMBOLS break; end end end if line:find'{' then multiline_comment = true; end end end end registerAutoAssemblerPrologue(onAutoAssemble); local main = getMainForm(); local btn = createButton(main); btn.width,btn.height,btn.top,btn.left = 100,30,290,460; btn.caption = 'clear U-symbols'; btn.onClick = function() autoAssemble(table.concat(__SYMBOLS,'\n')); __SYMBOLS = { }; end