Simple inheritance?

I don’t actually know Lua, at least not at a deep level. And while I’d love to be able to say else-wise, that is not likely to change.

Can someone give me some quick example code of how to do single inheritance in Codea?

@SciQuest

See the discussion started by @jminor titled ‘Class Inheritance’ back in November 2011. That might give you some information.

Here is the relevant link: http://twolivesleft.com/Codea/Talk/discussion/96/class-inheritances

Thank you both. Sorry for the question, I needed a quick answer for my class and did not have the opportunity to do a thorough search.

That said, my class is coming along nicely! I have the curriculum worked out so its actually enjoyable now. Once I refine the code a bit more I’ll post it… assuming I get that done before the FLL robotics season sucks me up.

Btw, I have another fundamental problem:

I have a variable “foo”. It is set to an instance of some class. I need to test to see if foo is an instance of class “bar”. How do I do this?

I think this is what you are looking for:


if foo:is_a(bar) then
   -- do whatever
end