Re: regarding loadstring
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: regarding loadstring
- From: "Xu Wang" <xu4wang@...>
- Date: 2007年12月10日 13:43:04 +0800
OK. I understood. thanks Jim.
On 10/12/2007, Jim Whitehead II <jnwhiteh@gmail.com> wrote:
> On 12/10/07, Xu Wang <xu4wang@gmail.com> wrote:
> > Hi Luaer,
> >
> > I'm trying to dynamically evaluate a string but got the following confuse.
> >
> >
> > > func=function() return "hello" end
> > > =func()
> > hello
> > > a=loadstring('func()')
> > > rval=a()
> > > =rval
> > nil
> >
> > 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()')
>
> - Jim
>