Kouksi44, on 05 July 2016 - 09:17 PM, said:
Exerro, on 05 July 2016 - 08:07 PM, said:
Lupus590, on 05 July 2016 - 07:12 PM, said:
Lua's require() uses ".", and I personally prefer it as it's more namespacey and less path/to/file-ey.
On the topic of the library:
This is awesome! It's really similar to how I did classes in Sheets, so naturally I'd think it has nice syntax and functionality. However, this has the added benefit of the magic metatable stuff for giving properties to fields of the class, which I have to admit is really clever and looks almost native.
My one real reservation is the name 'init' for the constructor. I've wanted to use a function called 'init' to initialise various things of a class in the past, so I think it'd be much better to use the name of the class as a constructor (i.e. Button:Button() not Button:init()).
Glad you like it!
A previous version of classic used the classname for the constructor but I think i changed it because I thought it looked a bit weird to write a function called
function Button:Button ()
However I might change this again in the next update.
One thing I just realized :
Right now, you should avoid using ClassTypes or declaring class members that hold Objects in general.
Accessing those members won't work as copying those Objects once the class instance is created is a bit buggy.
So I can't pass an object as argument? I have something like this:
... class "Window" implements "IWindow" { prop1; prop2; noObjectHereReally; } function Window:init(prop1,prop2) self.prop1 = prop1 self.prop2 = prop2 end interface "IDecorator" { draw = function(self, windowObject) -- Its only required here -- Code using values from windowObject end; } class "Decorator" implements "IDecorator" { prop1; prop2; noObjectHereReally; } function Decorator:init(prop1,prop2) self.prop1 = prop1 self.prop2 = prop2 endIt ruins a bit my work :/
Edited by thecrimulo, 06 July 2016 - 12:43 AM.