Author Topic: Lua Classes and OOP Tutorial  (Read 8734 times)

0 Members and 1 Guest are viewing this topic.

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Lua Classes and OOP Tutorial
« 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/

Please comment so we can improve the tutorial even more !

Thanks !
« Last Edit: August 25, 2011, 10:23:09 am by adriweb »
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: Lua Classes and OOP Tutorial
« Reply #1 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?
« Last Edit: August 25, 2011, 10:57:58 am by ExtendeD »
Ndless.me with the finest TI-Nspire programs

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: Lua Classes and OOP Tutorial
« Reply #2 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.
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: Lua Classes and OOP Tutorial
« Reply #3 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).
« Last Edit: August 25, 2011, 10:53:36 am by Levak »
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: Lua Classes and OOP Tutorial
« Reply #4 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
« Last Edit: August 25, 2011, 10:57:41 am by ExtendeD »
Ndless.me with the finest TI-Nspire programs

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: Lua Classes and OOP Tutorial
« Reply #5 on: August 25, 2011, 11:16:33 am »
Yeah, thanks you for feedback.
We will work on that =)
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: Lua Classes and OOP Tutorial
« Reply #6 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)
« Last Edit: September 18, 2011, 08:45:21 am by Levak »
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua