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

After I restart server

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

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


Write code:

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

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?