[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: regarding loadstring
- From: "Jim Whitehead II" <jnwhiteh@...>
- Date: Mon, 10 Dec 2007 03:25:24 +0000
On 12/10/07, Xu Wang <email@example.com> wrote:
> Hi Luaer,
> I'm trying to dynamically evaluate a string but got the following confuse.
> > func=function() return "hello" end
> > =func()
> > a=loadstring('func()')
> > rval=a()
> > =rval
> I was expecting rval=='hello'
> please point out what's wrong in the code above. Thanks.
Your function a does not return anything. What you want instead is:
a = loadstring('return func()')