[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Detecting expressions
- From: Mark Hamburg <mhamburg@...>
- Date: Sat, 10 May 2003 11:06:05 -0700
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
>