Omnimaga

Calculator Community => TI Calculators => Lua => Topic started by: Adriweb on August 25, 2011, 10:22:06 am

Title: Lua Classes and OOP Tutorial
Post by: Adriweb on August 25, 2011, 10:22:06 am
Hey guys !

As you may or may not know, Inspired Lua had a nice tutorial about Classes and OOP in Lua for the Nspire, but it was not translated into English (only French was available).
This time is over and I'm proud to announce a complete tutorial in English :P

Here's the link : http://www.inspired-lua.org/2011/05/5-object-classes/ (http://www.inspired-lua.org/2011/05/5-object-classes/)

Please comment so we can improve the tutorial even more !

Thanks !
Title: Re: Lua Classes and OOP Tutorial
Post by: ExtendeD on August 25, 2011, 10:41:47 am
Nice adriweb, this should help beginners.

Just two remarks:
- I fear that the introduction and the "myTable.A.C.D.var" example may lose the reader, since this syntax will never be used, and is just a symbolic representation which doesn't really support inheritance anyway.
- Could you provide examples of inheritance with the TI-Nspire class API?
Title: Re: Lua Classes and OOP Tutorial
Post by: Adriweb on August 25, 2011, 10:44:31 am
Thanks Extended.

I will try to make something up for the 2nd point.

About that 1st point, I understand your concern since I myself was not sure how to introduce it correctly. (the original tutorial was made by Levak, and I translated it).
I might make chapters and a Table of contents saying that some introductory points can be skipped.
Title: Re: Lua Classes and OOP Tutorial
Post by: Levak on August 25, 2011, 10:52:30 am
- I fear that the introduction and the "myTable.A.C.D.var" example may lose the reader, since this syntax will never be used, and is just a symbolic representation which doesn't really support inheritence anyway.

Well ... I have no words to answer you on that point. I felt it was important to show the flexibility of Lua tables, that it can handle multi-type elements, such as tables, functions and "objects" (tables indeed).
Title: Re: Lua Classes and OOP Tutorial
Post by: ExtendeD on August 25, 2011, 10:57:17 am
I see.

Maybe this introduction could be modify by:
- Removing inheritance here that doesn't really make sense
- Showing that this standard syntax can be used to define object-oriented singletons with a example similar to the existing one
- Explaining that a more advanced syntax is needed to define real usable classes: either Lua's metatable or the TI-Nspire's class() function
Title: Re: Lua Classes and OOP Tutorial
Post by: Levak on August 25, 2011, 11:16:33 am
Yeah, thanks you for feedback.
We will work on that =)
Title: Re: Lua Classes and OOP Tutorial
Post by: Levak on September 18, 2011, 08:45:05 am
Updated =)
http://www.inspired-lua.org/?p=172

PS : Adriweb hasn't corrected English mistakes yet x)