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!
Class-completion in lua? (OOP)
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement