[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Function Pointers?
- From: "John S. Miley" <jmiley69@...>
- Date: Fri, 16 Nov 2001 13:10:15 -0600
Thanks! That worked perfectly. :)
--jsm
> -----Original Message-----
> From: owner-lua-l@tecgraf.puc-rio.br
> [mailto:owner-lua-l@tecgraf.puc-rio.br]On Behalf Of Nick Trout
> Sent: Friday, November 16, 2001 1:08 PM
> To: Multiple recipients of list
> Subject: Re: Function Pointers?
>
>
> > One more question on the topic...in the below listing, the
> call gl.a()
> > works, but the call gl.b(1) produces an error, saying that "t" is
> > nil...looks like the parameter is not being passed. How do
> I get around
> > that?
> >
> > tab = {}
> >
> > function tab:test1()
> > print ("Hello from test1")
> > end
> >
> > function tab:test2(t)
> > print ("Hello from test2 " .. t)
> > end
> >
> > gl =
> >
> > a = tab.test1,
> > b = tab.test2
> > }
> >
> > gl.a()
> > gl.b(1)
>
> Hi John,
>
> gl.b(1) fails because it should be gl:b(1) ie. not the : not
> . This adds
> "self" so tab:test2 can reference itself through the variable
> "self" (if
> youve used Python, you have declare self yourself!).
>
> There is lots of sample code on the wiki if you'd like to
> take a stroll:
> http://lua-users.org/wiki/SampleCode
>
> Regards,
> Nick
>
>
>
>
>