[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Access of Object Arrays
- From: "Nick Trout" <nick@...>
- Date: Mon, 30 Apr 2001 15:57:19 +0100
>>Is there any way to avoid the first or second mention of test[1]?
The function will always use the first parameter as its object, so I could
also write:
I think the syntax of what you trying to do should be:
test[1].do_something(test[1]) -- calling with self as 1st parameter
is equivalent to: (not : instead of .)
test[1]:do_something() -- a call
then you have an "automatic" variable created called "self". (section 4.5.9
in manual).
eg.
function test[1]:do_something()
self.var = 12345
end
I dont much care for these automatic variables but thats a different story.
The above is equivalent to:
function test[1].do_something(self)
self.var = 12345
end
>> test[2].do_something(test[1])
I assume this is a typo.
Regards,
Nick