lua-users home
lua-l archive

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

Say if implement mentioned "Point" as a class, there will be no sense
in method (Point:moveTo(x, y)) ?

There would, kinda, point:moveTo should return a point moved by x/y. Maybe calling it "add" would be better tough.

Especially with primitives like points (or complex numbers in general), immutability makes a lot of sense in more complicated projects saving a lot of "protective copying" not knowing when a callee might change your data...