Offline documents and videos and notification on new documents,tutorials and videos

OOP in Lua without using MetaTables

OOP in Lua without using MetaTables

Postby Shando » 29 Mar 2015, 05:55

Hi all,

I have just put up a new Tutorial on the Wiki:

http://www.chi-ad.com/DokuWiki/doku.php/shando_manual:oopinlua

Since I can't seem to get my head around MetaTables (@ant0N - any chance of creating a tutorial on how to use MetaTables??), I found a Tutorial on the web that explained how to use OOP in Lua, without using MetaTables ;) From this, I created my own, which I have now uploaded onto the Wiki.

Shando

PS: for those of you who want to see the original Tutorial I found, it's available here:

http://theindiestone.com/forums/index.php/topic/8023-simple-lua-oop-without-metatables/
Ryzen 7 4800H 16GB GTX1650 Win 11 64
Love, Hope, Strength http://www.lovehopestrength.co.uk
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 560
Joined: 06 Mar 2013, 22:35
Location: Moffat Beach, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer

Re: OOP in Lua without using MetaTables

Postby ant0N » 29 Mar 2015, 08:08

Thank you! this is a great tutorial. ;)

I can write about metatable, but I can't properly write comments in English. :D
Sorry for my English. :)
User avatar
ant0N
Skyline Moderator
Skyline Moderator
 
Posts: 415
Joined: 02 Nov 2012, 12:49
Location: Россия, Москва
Skill: Programmer
Skill: 3D Modeller

Re: OOP in Lua without using MetaTables

Postby Shando » 29 Mar 2015, 10:42

Hi ant0N,

If you want, you can write it in Russian and then use some translator (Google Translate, Systran, PROMT etc.) to convert it to English.

Obviously, your English is better than my Russian ;) but my Dad can speak and read Russian, so I could ask him to take a look, and let us know if the translation is accurate (unfortunately, he's not really computer literate, but he can let me know the general translation, and I can then reword as necessary??).

Let me know if you need any help.

Shando
Ryzen 7 4800H 16GB GTX1650 Win 11 64
Love, Hope, Strength http://www.lovehopestrength.co.uk
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 560
Joined: 06 Mar 2013, 22:35
Location: Moffat Beach, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer

Re: OOP in Lua without using MetaTables

Postby ant0N » 29 Mar 2015, 10:49

OK, I'll write in English, but it will have to edit later. :)

thanks for the help!
Sorry for my English. :)
User avatar
ant0N
Skyline Moderator
Skyline Moderator
 
Posts: 415
Joined: 02 Nov 2012, 12:49
Location: Россия, Москва
Skill: Programmer
Skill: 3D Modeller

Re: OOP in Lua without using MetaTables

Postby StarFire » 30 Mar 2015, 14:33

Great doc Shando, I will try using this method on my next play with Lua.

antON this would be great, we have given you access to the wiki and set you up with a development area. Check your pm for login info.
Dream the Journey, Live the Experience!
User avatar
StarFire
Skyline Founder
Skyline Founder
 
Posts: 1678
Joined: 03 Jan 2012, 18:50
Location: UK
Skill: Great creative
Skill: Programmer
Skill: 3D Modeller
Skill: 2D Artist
Skill: Level Designer

Re: OOP in Lua without using MetaTables

Postby SolarPortal » 30 Mar 2015, 16:09

@antON, i have pm'd you with login details.

@Shando, very nice approach. It's a very simple and elegant solution. I didn't know you could create functions with the "dot". I have been using the single colon, which i don't like very much.
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: OOP in Lua without using MetaTables

Postby ant0N » 30 Mar 2015, 16:31

I started to write your tutorial. With metatable you will get much more fun.. :lol:
Sorry for my English. :)
User avatar
ant0N
Skyline Moderator
Skyline Moderator
 
Posts: 415
Joined: 02 Nov 2012, 12:49
Location: Россия, Москва
Skill: Programmer
Skill: 3D Modeller

Re: OOP in Lua without using MetaTables

Postby StarFire » 30 Mar 2015, 16:40

Look forward to reading it. You guys are showing me how much more powerful Lua is than I thought. Always nice to learn new things :D
Dream the Journey, Live the Experience!
User avatar
StarFire
Skyline Founder
Skyline Founder
 
Posts: 1678
Joined: 03 Jan 2012, 18:50
Location: UK
Skill: Great creative
Skill: Programmer
Skill: 3D Modeller
Skill: 2D Artist
Skill: Level Designer

Re: OOP in Lua without using MetaTables

Postby ant0N » 01 Apr 2015, 08:57

Finished two articles. I hope someone will correct my English... :lol:
http://www.chi-ad.com/DokuWiki/doku.php/anton_manual:oop
Sorry for my English. :)
User avatar
ant0N
Skyline Moderator
Skyline Moderator
 
Posts: 415
Joined: 02 Nov 2012, 12:49
Location: Россия, Москва
Skill: Programmer
Skill: 3D Modeller

Re: OOP in Lua without using MetaTables

Postby SolarPortal » 01 Apr 2015, 09:40

Well done & very interesting antON!
I think your english is fine and very readable :D

Lua is a very powerful language and continues to amaze me with the amount of workflows it has. :)
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 4770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3631
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: OOP in Lua without using MetaTables

Postby Shando » 01 Apr 2015, 10:15

@ant0N - as I expected, your English is definitely better than my Russian 8-)

Very nice tutorial and very understandable. Now, I just have to go into a darkened room, read your tutorial many times and convince myself that I can learn how to use metatables :lol:

Shando
Ryzen 7 4800H 16GB GTX1650 Win 11 64
Love, Hope, Strength http://www.lovehopestrength.co.uk
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 560
Joined: 06 Mar 2013, 22:35
Location: Moffat Beach, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer

Re: OOP in Lua without using MetaTables

Postby ant0N » 01 Apr 2015, 10:47

Thanks for the kind words! :D :D

Shando, it is actually much easier than it seems at first glance. :)
Sorry for my English. :)
User avatar
ant0N
Skyline Moderator
Skyline Moderator
 
Posts: 415
Joined: 02 Nov 2012, 12:49
Location: Россия, Москва
Skill: Programmer
Skill: 3D Modeller


Return to Documents, Tutorials and Videos

Who is online

Users browsing this forum: No registered users and 5 guests

cron