local code = ''
local file = io.open('moonloader/lib/imgui.lua','r')
code = (file:read('*a') )
file:close()
code = code:match('namespace ImGui%s*\n%s*{%s*\n(.+)\n%s+// Channels\n')
local text = '{scope = "source.lua",completions = {'
for n in code:gmatch('[^\n]+') do
if n:find('IMGUI_API %S+') then
local annotation = n:match('IMGUI_API (%S+)')
n = n:gsub(' IMGUI_API %S+%s+',''):gsub('%s+//.+$',''):gsub('%s+%S+%(%d+%)',''):gsub(';',''):gsub('^%s+',''):gsub('%s+//','')
-- text = text .. ('{"%s","%s"},\n'):format(text,'123')
text = text .. '{trigger="imgui.'..n:gsub('%(.+%)',''):gsub('%"',"'") ..'",content="'..n:gsub('%"',"'") ..'",annotation="'..annotation..'"},\n'
end
end
text = text .. '}}'
local f,err = load('return '..text)
print(err)
local t = f()
for k,v in pairs(imgui) do
if type(v) == 'table' then
for kk,vv in pairs(imgui[k]) do
if type(vv) == 'string' or type(vv) == 'number' then
print(k,kk,vv)
table.insert(t.completions,{
trigget = 'imgui.'..k,
content = 'imgui.'..k..'.'..kk,
annotation = k..'-'..kk..'('..vv..')',
})
end
end
end
end
local t = encodeJson(f())
local f = io.open('moonloader/1.txt','w')
f:write(text):close()