Jump to content

  • Log In with Google      Sign In   
  • Create Account


Class-completion in lua? (OOP)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 OmarShehata   Members   -  Reputation: 184

Like
0Likes
Like

Posted 14 June 2012 - 04:36 AM

So I've been delving into Lua for a few days, and I've been reading about how to use metatables and whatnot to "simulate" OOP. However one thing that I can't seem to get the hang of is, assume I've gotten a "class" set up as a table with functions and variables inside this table.

Now when I make an "instance" of this "class", and set it as my metatable and all that, a really crucial thing is that when I type dot after my object, it should show the methods and variables inside its class. Otherwise things can get pretty messy.

Any idea how I can get this done? I'm using Sublime Text 2 as my code editor.

Thanks!

Sponsor:

#2 OmarShehata   Members   -  Reputation: 184

Like
0Likes
Like

Posted 18 June 2012 - 02:46 AM

For anyone who's interested, this doesn't actually seem to be possible due to Lua's loose nature. And while not directly fixing this, some scripts which are based on Lua make using it have a lot less headaches such as MoonScript which seems to be better at OOP, as well as Squirrel and Killa. All these scripts compile to Lua.

I've chosen to use Killa because it has the least changes to the structure of the language so that it can be easily used/ported with existing code and adds some really crucial stuff.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS