Omnimaga

Calculator Community => TI Calculators => Lua => Topic started by: XVicarious on April 14, 2011, 09:36:49 pm

Title: Lua2TI
Post by: XVicarious on April 14, 2011, 09:36:49 pm
Lua2TI



http://www.omnimaga.org/index.php?action=downloads;sa=view;down=651

Lua2TI is a program to convert your Lua source files into TNS documents for use on the Nspire (v3.0).

You need to have .Net Framework 4.0 to use this program!

Directions:
1. Open program and browse for your *.lua source code.
2. Press "Convert to TNS!"
3. The output *.tns file should be called Document.tns, now load up the tns onto your calculator or Nspire Student Software and enjoy!

Please do not redistribute this, the only two places (for now) I want this is here at Omnimaga or on my website at http://www.kilmarentertainment.webege.com

For sources: http://www.kilmarentertainment.webege.com/apps/downloads/Lua2TI.tar.gz
Title: Re: Lua2TI
Post by: ruler501 on April 14, 2011, 09:43:26 pm
Yes finally a Windows one!

Does this work with special chars?
Title: Re: Lua2TI
Post by: DJ Omnimaga on April 14, 2011, 09:44:32 pm
Nice. I think I'll move this auto-post in the Lua section. Also I'm happy this one has a GUI. I kinda prefer that to having to go through command prompt. XD

This is definitively a must upload on Ticalc.org and TI-BANK too.
Title: Re: Lua2TI
Post by: XVicarious on April 14, 2011, 09:46:56 pm
by special you mean: " < > '? Or others? If others specify and ill updated it,
Title: Re: Lua2TI
Post by: Goplat on April 14, 2011, 09:48:20 pm
Don't forget &
Title: Re: Lua2TI
Post by: XVicarious on April 14, 2011, 09:49:14 pm
okay... Updating now...
Title: Lua2TI
Post by: XVicarious on April 14, 2011, 10:05:23 pm
Lua2TI



http://www.omnimaga.org/index.php?action=downloads;sa=view;down=651

Lua2TI is a program to convert your Lua source files into TNS documents for use on the Nspire (v3.0).

Directions:
1. Open program and browse for your *.lua source code.
2. Press "Convert to TNS!"
3. The output *.tns file should be called Document.tns, now load up the tns onto your calculator or Nspire Student Software and enjoy!

Please do not redistribute this, the only two places (for now) I want this is here at Omnimaga or on my website at http://www.kilmarentertainment.webege.com

Updated with "&" as first character to replace due to special formatting for the XML
Title: Re: Lua2TI
Post by: Yeong on April 15, 2011, 12:34:06 am
Wow....This fast?! O.O
Title: Lua2TI Linux
Post by: XVicarious on April 15, 2011, 01:10:40 am
Lua2TI Linux



http://www.omnimaga.org/index.php?action=downloads;sa=view;down=652

Convert your Lua sources to TNS files on Linux!

Requires the Mono Framework (v3.5)

1. Open file in Lua2TI
2. Press "Convert to TNS!"
3. Use the file (should be in the directory that the program is in!)
Title: Re: Lua2TI
Post by: Lionel Debroux on April 15, 2011, 02:55:06 am
On *nix, you may want to delegate the processing to the bash or Python script, and make only the GUI front-end (for selecting input and output file names) in Mono :)
Likewise on Windows if someone made a PowerShell script.

That's how TILP, GFM and KTIGCC ought to work, in fact.
Title: Re: Lua2TI
Post by: Munchor on April 15, 2011, 07:43:16 am
Can anyone share the algorithm for this? I'd like it :D
Title: Re: Lua2TI
Post by: ruler501 on April 15, 2011, 08:46:55 am
They have a python version of it. That one if you look at the code shows pretty much everything about it
Title: Re: Lua2TI
Post by: Lionel Debroux on April 15, 2011, 08:53:42 am
The shell script version shows it as well:
* add an XML header and an XML footer to the Lua code;
* ZIP the result;
* put the ZIP at the end of an empty TNS document (which is made of 368 bytes worth of data compressed with an unknown format)
Title: Re: Lua2TI
Post by: XVicarious on April 15, 2011, 02:20:34 pm
@Debroux: I just compiled my C# source for Linux, it was much easier than reinventing the wheel :P
Title: Re: Lua2TI
Post by: XVicarious on April 15, 2011, 04:01:26 pm
Link to sources added in first post, that is for both Windows and Linux... And Mac too I suppose.  Remember, you will need "7za" for the compression!
For Windows: http://downloads.sourceforge.net/sevenzip/7za920.zip
For Linux: http://sourceforge.net/projects/p7zip/files/p7zip/9.20.1/p7zip_9.20.1_x86_linux_bin.tar.bz2/download
For Mac: http://mac.softpedia.com/get/Compression-Tools/p7zip.shtml
Title: Re: Lua2TI
Post by: Ashbad on April 15, 2011, 05:03:59 pm
Sorry if this is the wrong place but...

where can you get all of the libraries for Lua development?
Title: Re: Lua2TI
Post by: XVicarious on April 15, 2011, 06:10:45 pm
I don't know really... They are built into the parser, its an interpreted language much like BASIC, the funtions that we know work are located here : https://docs.google.com/document/d/1qsExH5xZKx73mShdI8B8eA1ZCcmmZZnJ9TzrLwvKKFM/edit?hl=fr&authkey=CIGfyZQN#
Title: Re: Lua2TI
Post by: DJ Omnimaga on April 16, 2011, 12:44:27 am
Cool! Hopefully if someone wants to add more features later he can continue it. :D
Title: Re: Lua2TI
Post by: XVicarious on April 16, 2011, 09:49:24 pm
:D Right now I'm working on making a TNS (that was created with Lua2TI or the likes) to a Lua source file.
Title: Re: Lua2TI
Post by: apcalc on April 16, 2011, 10:16:14 pm
:D Right now I'm working on making a TNS (that was created with Lua2TI or the likes) to a Lua source file.

Sounds good!  This might really come in handy, as I can't seem to be able to extract the code from the Periodic Table (although others, like 15 Puzzle, will work). :(
Title: Re: Lua2TI
Post by: XVicarious on April 16, 2011, 10:18:09 pm
I believe Goplat said something about the compression being different than normal about it being a few bytes off.
Title: Re: Lua2TI
Post by: Lionel Debroux on April 17, 2011, 01:37:33 am
As posted elsewhere, TI's file for periodic table is entirely compressed with the unspecified 0D compression method, instead of the standard 08 DEFLATE method.
However, files created by the various Lua to TNS incarnations have a part compressed with the 0D compression method, which we're putting at the beginning of the file, and a part (made of three sub-parts) compressed with the standard 08 method. Any well-behaved program or library with ZIP opening capability can perform the TNS to Lua conversion :)
Title: Re: Lua2TI
Post by: XVicarious on April 17, 2011, 11:02:59 am
Lua2TI has been uploaded to TI-Bank. I'm working on getting a Mac version up
Title: Re: Lua2TI
Post by: Lionel Debroux on April 17, 2011, 11:12:56 am
Go ahead, but FYI, AdRiWeB has already made a native Mac executable, which has the significant advantage (from a user's POV) of not requiring the dependency on the non-native Mono stuff ;)
Title: Re: Lua2TI
Post by: XVicarious on April 17, 2011, 04:58:58 pm
I actually think that my new linux executable might not need mono, it has it everything it needs packaged up
Title: Re: Lua2TI
Post by: DJ Omnimaga on April 17, 2011, 09:42:16 pm
Sounds nice Jkag. By the way if http://ourl.ca/10458.new#new ever got finished, do you think in the future conversion between OS 1.x/2.0 Ndless Lua files and 3.0 Lua TNS files would be possible? It would be nice to run Lua games on older OSes, but of course Lua for Ndless would have to be finished by someone else, first.
Title: Re: Lua2TI
Post by: XVicarious on April 18, 2011, 12:23:09 am
It may be very possible, I'd have to see format difference, all that the Lua to TNS converters to is make the source into XML, so if that is about what has to be done, it would be very possible.  I'd really have to see the format though
Title: Re: Lua2TI
Post by: ruler501 on April 18, 2011, 07:05:56 pm
I used the windows version of this to convert this code to .tns and I am getting an error when opening it on my Nspire

Code:
Code: [Select]
c = “”
function on.charIn(ch)
    c = ch
    platform.window:invalidate()
end

function on.paint(gc)
    gc:setFont(“sansserif”, “r”, 10)
    gc:drawString(c, 0, 0, “top”)
end

Error:
Code: [Select]
unexpected symbol near 'char(239)'
Is it just bad code or what
Title: Re: Lua2TI
Post by: XVicarious on April 19, 2011, 10:03:43 am
I really don't know lol. I don't know Lua very well, but did you check the syntax (I think there is a syntax checker built into Lua) before you converted it?

And TNS -> Lua is amost done.  Some reason I'm having trouble with changing the "&amp;" (etc) back to their normal counterparts.
Title: Re: Lua2TI
Post by: pianoman on June 05, 2011, 01:09:10 pm
I'm having some trouble with this for Windows... everytime i load the document.tns onto the calc, it just gives me a message about the file format not being supported.
Any thoughts?
Title: Re: Lua2TI
Post by: Lionel Debroux on June 05, 2011, 01:11:53 pm
That's natural, if you have OS 3.0.2: it doesn't support files generated by third parties.
Either open the file with OS 3.0.1 and save it, or use TI Nspire Computer Software and the converter program leaked involuntarily by a third party, then officially released by TI.
Title: Re: Lua2TI
Post by: pianoman on June 05, 2011, 01:12:35 pm
But I have 3.0.1
Title: Re: Lua2TI
Post by: pianoman on June 06, 2011, 09:42:43 pm
Wait, do you need to have 7-zip installed for it to work?
Title: Re: Lua2TI
Post by: Lionel Debroux on June 07, 2011, 02:05:32 am
Maybe one of the third-party converters does, I don't remember.