when i input these strings i want it to return a table info of the same name
example strings:
"windower.ffxi.get_mob_by_target('t').name"
"windower.ffxi.get_mob_by_target('t')"
"windower.ffxi.get_mob_name(1234).name"
"windower.ffxi.get_mob_name(1234)"
"windower.ffxi"
currently the best i can do are these
example strings:
"windower.ffxi.get_mob_by_target('t')"
"windower.ffxi.get_mob_name(1234)"
"windower.ffxi"
with this code
function s_to_t(s)--string to table
local str = s
local f = (str:match('%(%)') or str:match("%('(.+)'%)") or nil)
if f then
str = (f == '()' and string.gsub(str, '%(%)', "") or string.gsub(str, "%('"..f.."'%)", ""))
end
local t = {0}
local tbl = string.find(str,'%.')
while tbl do
t[#t+1]=tbl tbl = string.find(str,'%.',tbl+1)
end
t[#t+1]=#str+1
local g = _G
for i = 1,#t-1 do
g = g[string.sub(str,t[i]+1,t[i+1]-1)]
end
if f then
if f == '()' then
return g()
else
return g(f)
end
else
return g
end
end
local tbl = s_to_t(str)
help would be appreciated



