Author Topic: Numstrat - Stumbling into Lua  (Read 11166 times)

0 Members and 1 Guest are viewing this topic.

Offline Jonius7

  • python! Lua!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1918
  • Rating: +82/-18
  • Still bringing new dimensions to the TI-nspire...
    • View Profile
    • TI Stadium
Re: Numstrat - Stumbling into Lua
« Reply #30 on: August 13, 2013, 03:26:13 am »
Levak made an excellent Lua sudoku btw (quite advanced/complex Nspire Lua though) available here :
http://levak.free.fr/ftp/nspire/Sudoku/

I could not find this anywhere on Omnimaga, then realised it probably was on TI Planet. It was.
The .tns file from levak.free.fr works.
But using the sourcecode (.lua) and compiling with Luna I cannot get the code to run at all with
Error: attempt to call global 'PushScreen' (a nil value)

As I do not understand French, posting in English on TI Planet would be quite weird...

I was looking at this topic when I saw the link for Sudoku above.
This is probably totally off topic. ;)
« Last Edit: August 13, 2013, 03:39:17 am by Jonius7 »
Programmed some CASIO Basic in the past
DJ Omnimaga Music Discographist ;)
DJ Omnimaga Discography
My Own Music!
My Released Projects (Updated 2015/05/08)
TI-nspire BASIC
TI-nspire Hold 'em
Health Bar
Scissors Paper Rock
TI-nspire Lua
Numstrat
TI-nspire Hold 'em Lua
Transport Chooser
Secret Project (at v0.08.2 - 2015/05/08)
Spoiler For Extra To-Be-Sorted Clutter:

Spoiler For Relegated Projects:
TI-nspire BASIC
Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled) | Cosmic Legions (stalled)
Axe Parser
Doodle God (stalled while I go and learn some Axe)

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: Numstrat - Stumbling into Lua
« Reply #31 on: August 13, 2013, 07:20:04 am »
But using the sourcecode (.lua) and compiling with Luna I cannot get the code to run at all with
Error: attempt to call global 'PushScreen' (a nil value)
Have you followed the correct order of source-concatenation described in http://levak.free.fr/ftp/nspire/Sudoku/MakeFile.sh ?

i.e:
Buttons.lua
Menu.lua
Request.lua
Constants.lua
ScreenManager.lua
Engine.lua
Help.lua
Sudoku.lua
« Last Edit: August 13, 2013, 07:27:42 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 Jonius7

  • python! Lua!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1918
  • Rating: +82/-18
  • Still bringing new dimensions to the TI-nspire...
    • View Profile
    • TI Stadium
Re: Numstrat - Stumbling into Lua
« Reply #32 on: August 14, 2013, 06:53:13 pm »
Hmm I see, that would probably be it. I was missing out on all those other files.
Looking at the MakeFile, I can see that it requires MakeTNS.py, which I have downloaded from ticalc.org.
Sudoku.lua isn't in the MakeFile commands...? Oh I see it is, it's at the top as a variable.

This would be the Linux commands more or less:
Code: [Select]
maketns.py Sudokut.tns Buttons.lua Menu.lua Request.lua Constants.lua ScreenManager.lua Engine.lua Help.lua Sudoku.lua
But since I use Windows, the MakeTNS readme told me to go into the dist folder and execute there
Code: [Select]
maketns Sudokut.tns Buttons.lua Menu.lua Request.lua Constants.lua ScreenManager.lua Engine.lua Help.lua Sudoku.lua
However it gave me an output of a 10kb tns file where the actual working tns is 13kb. And it wouldn't run on the calculator.

This seems overly complicated. But at least I learnt something.

Programmed some CASIO Basic in the past
DJ Omnimaga Music Discographist ;)
DJ Omnimaga Discography
My Own Music!
My Released Projects (Updated 2015/05/08)
TI-nspire BASIC
TI-nspire Hold 'em
Health Bar
Scissors Paper Rock
TI-nspire Lua
Numstrat
TI-nspire Hold 'em Lua
Transport Chooser
Secret Project (at v0.08.2 - 2015/05/08)
Spoiler For Extra To-Be-Sorted Clutter:

Spoiler For Relegated Projects:
TI-nspire BASIC
Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled) | Cosmic Legions (stalled)
Axe Parser
Doodle God (stalled while I go and learn some Axe)

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: Numstrat - Stumbling into Lua
« Reply #33 on: August 14, 2013, 07:29:52 pm »
... well
MakeTNS was used way before Luna ever existed, even before 0S 3.0.2 used to exist and block custom XML files without encoding.
Thus, files had to be resaved oncalc or using TINCS resulting in bigger files.
If you cannot run this file using 3.1.0 this is only because of that.
Just concatenate the files yourself and compile it with Luna.
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline Jonius7

  • python! Lua!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1918
  • Rating: +82/-18
  • Still bringing new dimensions to the TI-nspire...
    • View Profile
    • TI Stadium
Re: Numstrat - Stumbling into Lua
« Reply #34 on: August 14, 2013, 09:58:39 pm »
Oh of course, things were different in OS 3.0.x.
Interesting after manually concatenating all the files into one, I got a file size of 9kb. But it works!
Um, I found a bug almost straight away. If you press the delete key, it crashes.
« Last Edit: August 14, 2013, 09:59:16 pm by Jonius7 »
Programmed some CASIO Basic in the past
DJ Omnimaga Music Discographist ;)
DJ Omnimaga Discography
My Own Music!
My Released Projects (Updated 2015/05/08)
TI-nspire BASIC
TI-nspire Hold 'em
Health Bar
Scissors Paper Rock
TI-nspire Lua
Numstrat
TI-nspire Hold 'em Lua
Transport Chooser
Secret Project (at v0.08.2 - 2015/05/08)
Spoiler For Extra To-Be-Sorted Clutter:

Spoiler For Relegated Projects:
TI-nspire BASIC
Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled) | Cosmic Legions (stalled)
Axe Parser
Doodle God (stalled while I go and learn some Axe)

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: Numstrat - Stumbling into Lua
« Reply #35 on: August 15, 2013, 05:50:02 am »
if for 3.2, [lua]platform.registerErrorHandler[/lua] ftw :P

(/me runs or not, but meh, why not)

Anyway, as I'm sometimes saying, these scrits are indeed old-generation, with no techniques that have been "found"/written more or less recently, using deprecated code, not using the new things (obviously), etc. etc.
« Last Edit: August 15, 2013, 06:31:22 am by adriweb »
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Numstrat - Stumbling into Lua
« Reply #36 on: August 15, 2013, 06:03:17 am »
Well, you should always try to avoid that your script throws errors to the user level (so that you need to catch it with registerErrorHandler). Of course it's not bad to implement it in case that something goes wrong unexpectedly, but still a well designed script should never actually be able to arrive to that point.
« Last Edit: August 15, 2013, 06:05:49 am by Jim Bauwens »

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: Numstrat - Stumbling into Lua
« Reply #37 on: August 15, 2013, 06:31:36 am »
Well, you should always try to avoid that your script throws errors to the user level (so that you need to catch it with registerErrorHandler). Of course it's not bad to implement it in case that something goes wrong unexpectedly, but still a well designed script should never actually be able to arrive to that point.
Of course :)
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation