glon.encode Help

I’m encoding some bank data to a table and saving it to a file, however, when I save to the file it nests the table in a key of it’s own, instead of just copying it across.

When it’s first saved and loaded

http://s10.postimage.org/3lecdcfg7/luaerr1.png

After I restart server

http://s8.postimage.org/li21dsdjn/luaerr2.png

Read code:
[LUA]
function InitBankInfo(seccond)
if file.Exists(“UltimateRP/bank.txt”) then
BankInfo = glon.decode(file.Read(“UltimateRP/bank.txt”))
PrintTable(BankInfo)
else
if seccond then
print(“Loop protection: InitBankInfo infinite loop!”)
return
end

	file.Write("UltimateRP/bank.txt", glon.encode({}))
	InitBankInfo(true)
end

end
[/LUA]

Write code:

[LUA]
function WriteBankInfo()
if not BankInfo then error(“BankInfo has not been declared, InitBankInfo not run?”) end
file.Write(“UltimateRP/bank.txt”, glon.encode({BankInfo}))
end
timer.Create(“writeBankData”, 0, 3, WriteBankInfo)
[/LUA]

Anybody got any ideas, I don’t get any errors, their must be a design flaw but I can’t seem to spot it. Any help would be greatly appreciated.

Don’t put {} around BankInfo?

Fixed, thanks

[editline]21st November 2011[/editline]

Hey, I’m having another problem. I’m sending a bank id to the client via a usermessage on a float, when it arrives at the client, it’s always different from the server. Sometimes it’s one below, sometimes two higher.

Any ideas?