lua-users home
lua-l archive

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


Thanks. That did the trick.

Mark

on 5/10/03 6:19 AM, Luiz Henrique de Figueiredo at lhf@tecgraf.puc-rio.br
wrote:

>> Is there an easy way to tell whether a string is an expression?
> 
> Try wraping the string XXX as "return (XXX)" and using luaL_loadbuffer.
> If it returns 0, then XXX is ok and you can execute it simply by doing
> lua_pcall. The result of XXX will be left on he stack.
> 
> The parentheses try to limit XXX to a single expression. If you want to print
> multiple expressions, sijply remove them. luac.c does this for lines starting
> with "=".
> --lhf
>