[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Unexpected behaviour
- From: "Dirk Feytons" <dirk.feytons@...>
- Date: Thu, 2 Oct 2008 15:16:46 +0200
On Thu, Oct 2, 2008 at 3:10 PM, Tim Channon <tc@gpsl.net> wrote:
> Where does argument 3 go?
>
>
> tagclass = {}
> tagmetatable = {__index = tagclass}
> function tagclass.new (kind, args, body)
> local self = {}
> self.kind=kind
> self.args=args
> self.body=body
> setmetatable(self,tagmetatable)
> return self
> end
>
> function tagclass:show()
> print("kind",self.kind)
> print("args",self.args)
> print("body",self.body)
> end
>
> xx=tagclass:new("kindp", "argp", "bodyp")
This is syntactic sugar for
xx=tagclass.new(tagclass, "kindp", "argp", "bodyp")
You have to call your new() like a regular function:
xx=tagclass.new("kindp", "argp", "bodyp")
> xx:show()
>
> kind table: 00887f48
> args kindp
> body argp
--
Dirk