I read up on how one would go about doing this in regular Lua here, which, to its credit, explains it really well and has the excellent tried and true animal examples for class extension. In CC though I've had no luck so far, and just due to my inexperience in Lua I'm not quite sure how to even go about experimenting and would really appreciate a point in the right direction.
To give a bit more detail, I want to extend 'window' into 'labeledwindow', that basically has a prefixed label string, and when writing to the window, it's smart about knowing about its label and not overwriting it, etc. etc. It's pretty basic stuff and so far has been a great way to get used to Lua, I just can't figure out the inheritance :(/>
going off of the example in the link I posted above, I turned this:
require 'class'
Dog = class(Animal)
function Dog:speak()
return 'bark'
end
into:
require 'class'
labeledwindow = class(window)
function labeledwindow:rpwrite(window, text)
window.clear()
window.setCursorPos(1,1)
window.write(text)
end
attempt to call nil is thrown on the require 'class' line. i've also tried it without that require, the same error is thrown on the next line..again, I'm really not too sure how to even go about experimenting, so if anyone has any pointers, advice or otherwise, I would appreciate it so much!
(I haven't been able to find anything in the CC Wiki or otherwise regarding inheritance, but I apologize if something does exist, feel free to just point me there if my question's been answered elsewhere)
Thanks in advance everyone, if anyone needs any more info please just ask!