Hi ppl,
can somebody help me please.
I need convert this script, but that don't convert with plop's convertor, PLS help me!
This is part of the script, which I need convert in LUA 5.0.2:
arrRR = {}
fRR = "reqreg.dat"
function Main()
frmHub:RegBot(sBot)
LoadFromFile(fRR)
end
function OnExit()
SaveToFile(fRR,arrRR,"arrRR")
end
function SaveToFile(file , table , tablename)
writeto(file)
write(Serialize(table, tablename))
writeto()
end
function LoadFromFile(file)
if (readfrom(file) ~= nil) then
readfrom(file)
dostring(read("*all"))
readfrom()
PLS, help me with convert, it is very important!
Thank you in advance!!!
give this a try.
arrRR = {}
fRR = "reqreg.dat"
function Main()
frmHub:RegBot(sBot)
dofile(fRR)
end
function OnExit()
SaveToFile(fRR,arrRR,"arrRR")
end
function SaveToFile(file , tTable , tablename)
fFile = io.open(file, "w")
fFile:write(Serialize(tTable, tablename))
fFile:close()
end
function LoadFromFile(file)
local fFile = io.open(file)
if fFile then
dofile(file)
fFile:close()
end
end
function Serialize(tTable,sTableName,hFile,sTab)
sTab = sTab or "";
fFile:write(hFile,sTab..sTableName.." = {\n");
for key,value in tTable do
local sKey = (type(key) == "string") and os.format("[%q]",key) or os.format("[%d]",key);
if(type(value) == "table") then
Serialize(value,sKey,hFile,sTab.."\t");
else
local sValue = (type(value) == "string") and os.format("%q",value) or os.tostring(value);
fFile:write(hFile,sTab.."\t"..sKey.." = "..sValue);
end
fFile:write(hFile,",\n");
end
fFile:write(hFile,sTab.."}");
end
plop