> | Message: 6
> | Date: Tue, 19 Apr 2016 12:58:31 +0200
> | From: Ulrich Schmidt <email@example.com>
> | I like programming using OOP and it works quite well in Lua.
> | I don't miss anything related in lua, OK.
> | But sometimes when coding class methods and entering class names again
> | and again, i feel a wish comes up:
> | Would it be possible to implement a shortcut usable inside class
> | so i can write
> | :method instead classname:method
> | and
> | .field instead classname.field.
> | ?
> | Ulrich.
Do you mean simply that:
':method' would be a syntax shortcut for 'self:method'
'.field' would be a syntax shortcut for 'self.field'
Beyond that you are opening a (very familiar) can of worms. Lua does not
have the concept of 'class' and this concept can be implemented in many
different ways, so 'classname' could be a table or a userdata or in my
personal favourite style, a function closure. So there is no determinate
lexical context for a class - it all depends how you want to implement it.