Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Simple inheritance?

edited August 2012 in Questions Posts: 48

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?

Comments

  • dave1707dave1707 Mod
    Posts: 7,909

    @SciQuest

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

  • edited August 2012 Posts: 48

    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?

  • edited August 2012 Posts: 580

    I think this is what you are looking for:


    if foo:is_a(bar) then -- do whatever end
Sign In or Register to comment.