lua-users home
lua-l archive

Re: one more (stupid) idea ,,,

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> > :method instead self:method
> >and
> > .field instead self.field
When you define methods, use the full syntax and choose a one-letter
variable instead of self:
	function MyClass.myMethod(O, ...)
		return O:f() + O.n
	end
but call methods with the colon syntax:
	myObject:myMethod(...)
Your proposal is ambiguous syntax:
	a = b
	:method()
is the same as
	a = b:method()

AltStyle によって変換されたページ (->オリジナル) /