lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sun, Jan 26, 2014 at 6:03 PM, Robert Raschke <rtrlists@googlemail.com> wrote:

You could probably do something along the lines of:

f = assert( io.open("table.txt") )
s = f:read("*a")
f:close()
t = assert( loadstring("{"..s.."}") )()

I think this will work in 5.1. But in 5.2 you'll need to do something else for loadstring().

Robby

It'd have to be:
t = assert( loadstring("return {"..s.."}") )()

(and of course this still assumes the input is trustworthy.)

--
Sent from my Game Boy.