lua-users home
lua-l archive

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


> I donwloaded and compiled lua 5 beta and tried to test an old small test
app,
> but now i got an error about lua_dostring. What happened with it in
version
> 5? Which is the correct way to execute code from strings/files now?

I just happened to have the Lua 5beta refman open to that page (37 printed,
43 in Acrobat):

Quote:

- loadstring (string [, chunkname])
Loads a string as a Lua chunk. If there is no errors, returns the compiled
chunk as a
function; otherwise, returns nil plus an error message.

The optional parameter chunkname is the \name of the chunk", used in error
messages and debug information.

To load and run a given string, use the idiom
  assert(loadstring(s))()