lua-users home
lua-l archive

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


On Fri, May 2, 2014 at 5:41 PM, Thomas Jericke <tjericke@indel.ch> wrote:
> We have statements like:
> Module.Portal.Cmd.MoveXY(12, 24)
> Module.Head.Cmd.Pick()
> Module.Portal.Cmd.MoveXY(5, 22)
> Module.Head.Cmd.Place()
> ...
> over and over again and often the shortcut:
> local MovePortal = Module.Portal.Cmd.MoveXY
> MovePortal (12, 24)
> is used to call MovePortal without any table lookups involved.
>
> I am actually very satisfied with this solution,
> and of course I can't change that anymore now without braking all
> the scripts already written like this.

That seems a fair solution, for the situation you have.  Providing a
scripting interface is a decision that only you can make.  No one
would dispute that.

However, it's not a universal solution to Lua OOP, because of the
overhead (all objects must contain all the needed closures).