lua-users home
lua-l archive

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



Eric Ries wrote:
I am curious if it would be worthwhile to implement a perl-style eval() for executing lua code. Lua's dostring() is very close, but eval() has the added
advantage of automatically returning the last statement executed. So for
instance eval( "10" ) is equivalent to dostring( "return 10" )

so why not add just this line to your code?:

function eval(s) return dostring("return "..s) end

Steve