I'm messing around with Lua, trying to get OOP to work, ran into some issues and everything works on my end, but I want to know if I'm missing anything, or an unexpected issue will come up using this method to implement oop.
Basically I have a base class
local BaseClass = {}
function BaseClass.new()
local self = setmetatable({}, BaseClass)
return self
end
And then a child class
local ChildClass = {}
function ChildClass.new()
local self = BaseClass.new()
return self
end
Again, everything works, the childclass inherits all the members from the base class, and to my understanding methods are basically variables in lua, so it also inherits those, and then I can add specific members to childclass, and call those. So if it could be better (but still relatively lightweight), if I'll be hit with an unexpected issue or I'm doing something redundant, please let me know.