You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
local a={}function a.load(b)assert(type(b)=='string','Parameter "fileName" must be a string.')local c=assert(io.open(b,'r'),'Error loading file : '..b)local d={}local e;for f in c:lines()do local g=f:match('^%[([^%[%]]+)%]$')if g then e=tonumber(g)and tonumber(g)or g;d[e]=d[e]or{}end;local h,i=f:match('^([%w|_]+)%s-=%s-(.+)$')if h and i~=nil then if tonumber(i)then i=tonumber(i)elseif i=='true'then i=true elseif i=='false'then i=false end;if tonumber(h)then h=tonumber(h)end;d[e][h]=i end end;c:close()return d end;function a.save(b,d)assert(type(b)=='string','Parameter "fileName" must be a string.')assert(type(d)=='table','Parameter "data" must be a table.')local c=assert(io.open(b,'w+b'),'Error loading file :'..b)local j=''for e,h in pairs(d)do j=j..'[%s]\n':format(e)for k,i in pairs(h)do j=j..'%s=%s\n':format(k,tostring(i))end;j=j..'\n'end;c:write(j)c:close()end;return a