-- edit by kinn --[[ scite_Command { 'Shell tools |ShowShellTools|Ctrl+F7' } ]]-- --print('test========='..lua_LoadPath()) local my_path=lua_LoadPath() local len = string.len local dis_cmd_content={} local begcpyPos, endcpyPos, cmdStartcpyPos, cmdendcpyPos local cmd_name={} local cmd_count=0 local cmd_position={} local cmd_action={} local function updateCpyContent() if begcpyPos and endcpyPos then outputRemove(output,begcpyPos, endcpyPos) end begcpyPos = output.Length print() print('=====================================') cmdStartcpyPos=output.CurrentPos cmd_position[0]=output.CurrentPos local indx=1 while cmd_name[indx] do print(cmd_name[indx]) cmd_position[indx]=output.CurrentPos indx=indx+1 end cmd_count=indx cmdendcpyPos=output.CurrentPos print('-------------------------------') for k, t in pairs(dis_cmd_content) do if t then print(t) end end print('-------------------------------') endcpyPos = output.CurrentPos end local function makeVariable() local startPos=editor.SelectionStart local endPos=editor.SelectionEnd local sel = editor:textrange(startPos,endPos) editor:ReplaceSel('${'..sel..'}') end local function makeVariable2() local startPos=editor.SelectionStart local endPos=editor.SelectionEnd local sel = editor:textrange(startPos,endPos) editor:ReplaceSel('$('..sel..')') end local function init_command_tabl() cmd_name[1]='${XXX} ' cmd_name[2]='$(XXX) ' cmd_name[3]=' ' -- cmd_action[1]= makeVariable cmd_action[2]= makeVariable2 -- cmd_action[3]=updateCpyContent end scite_OnInit(function(order1,order2) init_command_tabl() return false end) local function clearMaintainParam() begcpyPos=-1 endcpyPos=-1 end local function PosMaintainAdjust(diff) begcpyPos = begcpyPos+diff endcpyPos = endcpyPos+diff cmdStartcpyPos = cmdStartcpyPos+diff cmdendcpyPos = cmdendcpyPos+diff local indx=1 while indx cmdStartcpyPos and output.CurrentPos < cmdendcpyPos then local indx=1 while indxoutput.CurrentPos and cmd_action[indx] then exe_command(cmd_action[indx],dis_cmd_content) break end indx=indx+1 end updateCpyContent() end return true end) function tool_for_check_global() local declaredNames = {} -- local g_t = _G -- start with the table of globals local g_meta = getmetatable(_G) local proxy = {} setmetatable(proxy, g_meta) setmetatable(_G, { __newindex = function(t, n, v) if not declaredNames[n] then local w = debug.getinfo(2, "S").what --print("***" .. w) if w ~= "main" and w ~= "C" then print("===" .. w) --error("attempt to write to undeclared variable "..n, 2) print("attempt to write to undeclared variable "..n, 2) end declaredNames[n] = true end rawset(t, n, v)-- do the actual set end, __index = function(_, k) if not declaredNames[k] then --print("attempt to read variable ".. k, 2) local v = proxy[k] if v then return v end print("attempt to read undeclared variable ".. k) return nil else print("never output this ".. k) end end }) end scite_OnOpenSwitch(tool_for_check_global) scite_OnInit(function(order1, order2) if order1 == 0 and order2 == 0 then tool_for_check_global() end return false end)