Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 92 users online: 1 member, 66 guests and 25 bots. Members: None. Bots: Alexa (1), Spinn3r (1), MSN/Bing (2), Magpie Crawler (3), Googlebot (2), Googlebot (16).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
|
| Author |
Message |
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55759 Location: Earth, Sol, Milky Way
|
Posted: 08 Sep 2012 12:23:04 am Post subject: LuaZM v0.1 Beta: Lua for the Casio Prizm 08 Sep 2012 |
|
|
The programming language Lua has been around for fifteen years, and has recently gained significant traction as an introductory scripting language. As I mentioned when I first announced the LuaZM project, the TI-Nspire CX has had Lua for about a year now, Texas Instruments' uneasy relationship with hobbyist programmers notwithstanding. I'm proud to release the first beta of LuaZM to the public, along with documentation on the current features of the core program and its included libraries. Create your own .lua programs, then use LuaZM's handy graphical file browser to select a program and run it. LuaZM also includes a command line where you can test out commands and functions. LuaZM is a semi-port of Lua 5.2.1. Please try out this beta, give me feedback, and start publishing your own Prizm Lua programs! Compatibility layers for Nspire and LuaFX programs may be coming soon. Special thanks go to Juju and AHelper for the PrizmIO console library and the File Browser GUI respectively.
Download & Read More
LuaZM v0.1 - Casio Prizm Lua Interpreter
LuaZM reference documentation
 _________________

Last edited by KermMartian on 09 Sep 2012 01:58:12 pm; edited 1 time in total |
|
| Back to top |
|
|
vebveb
Newbie

Joined: 02 Jul 2012 Posts: 24
|
Posted: 08 Sep 2012 04:41:08 am Post subject: |
|
|
You should add functions to scroll the screen of your clipping rectangle and to save it and restore it later (as in luaFX).
I think a compatibility layer for luaFX programs is possible, but some functionnalities will be difficult to make it compatible (I mean the file library and the module system). For the other functions, it is not quite difficult: add '(' and ')' to the .lua where it is needed, load a different library. |
|
| Back to top |
|
|
gbl08ma
Power User

Joined: 26 Nov 2011 Posts: 475 Location: Portugal
|
|
| Back to top |
|
|
flyingfisch

Super-Expert

Joined: 02 Feb 2012 Posts: 895 Location: Akron, OH
|
|
| Back to top |
|
|
gbl08ma
Power User

Joined: 26 Nov 2011 Posts: 475 Location: Portugal
|
|
| Back to top |
|
|
flyingfisch

Super-Expert

Joined: 02 Feb 2012 Posts: 895 Location: Akron, OH
|
Posted: 08 Sep 2012 09:20:20 am Post subject: |
|
|
Ah, OK.
Does anyone know why my program will not work though? It says there is a problem near <eof>. _________________

 
 |
|
| Back to top |
|
|
Ashbad

... I think redheaded girls are kind of cool

Joined: 01 Dec 2010 Posts: 2418 Location: Stomp Stomp Stomp, The Idiot Convention
|
Posted: 08 Sep 2012 09:51:40 am Post subject: |
|
|
| gbl08ma wrote: | | gbl08ma gets more and more annoyed that people don't use standard GetKey syscalls when possible... |
To be fair, it's not very game-friendly to use the syscalls, as they're a lot slower, can't detect more than one key at once, etc. I found a nice solution is to build two versions of the addin in question: one for hardware, and one that's (mostly) emulator friendly. Perhaps Kerm should consider the same And to Kerm specifically, I'm totally trying this out today. _________________ -Ashbad |
|
| Back to top |
|
|
gbl08ma
Power User

Joined: 26 Nov 2011 Posts: 475 Location: Portugal
|
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55759 Location: Earth, Sol, Milky Way
|
Posted: 08 Sep 2012 10:17:08 am Post subject: |
|
|
Yes, PrizmIO needs the modifier keys changed up; they're currently nonsensical. I have made suggestions to Juju about it, and since he's planning to make a lot of changes to PrizmIO based on my suggestions, I didn't bother making the changes myself yet. No sense doing it twice if he's going to get to it soon. If he's not, though, I'll just do it myself. Here were my suggestions:
http://www.cemetech.net/forum/viewtopic.php?p=188440#188440
Oh, and for what it's worth, PrizmIO currently uses Ashbad's system to check if keys are currently pressed or held.
Flyingfisch: Although that should work, what do you have against calling the functions directly? Is it faster that way? I'll try your code on my Prizm and see how it runs.
Edit: As requested, here is a list of planned features for LuaZM before 1.0:
:: Either get a fixed PrizmIO or fix PrizmIO
:: Finish overhauling IO library and include it. Add serial port support.
:: Finish overhauling OS library and include it.
:: Decide whether to include the Coroutines library
:: Decide whether to make a LuaFX compatibility layer or just port over (some or all) of the ten existing LuaFX programs. _________________
 |
|
| Back to top |
|
|
flyingfisch

Super-Expert

Joined: 02 Feb 2012 Posts: 895 Location: Akron, OH
|
Posted: 08 Sep 2012 11:08:26 am Post subject: |
|
|
| KermMartian wrote: |
Flyingfisch: Although that should work, what do you have against calling the functions directly? Is it faster that way? I'll try your code on my Prizm and see how it runs.
|
I guess I don't call functions directly because it seems like just about all LuaFX programs call them like that. I don't know if that is just veb's preference or not, but I have been doing it that way for quite a while.
So, while it may be faster (I don't know), I do it because I always have. Should I call them directly instead? _________________

 
 |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55759 Location: Earth, Sol, Milky Way
|
Posted: 08 Sep 2012 11:09:38 am Post subject: |
|
|
I suspect it might be slightly faster to do it that way. Can you use the zmg.ticks() function wrapped around 1000 calls of some function written both ways to see what the relative speeds are? _________________
 |
|
| Back to top |
|
|
vebveb
Newbie

Joined: 02 Jul 2012 Posts: 24
|
Posted: 08 Sep 2012 11:12:12 am Post subject: |
|
|
Yes, it faster:
local clear = zmg.clear
clear ()
first part : local clear = zmg.clear
search the global zmg
find the index clear
put the result in an upvalue
second part : clear()
load the upvalue
call it
and the other way: zmg.clear()
search the global zmg
find the index clear
call it
Then if we call a function multiple times, the first way is faster. |
|
| Back to top |
|
|
flyingfisch

Super-Expert

Joined: 02 Feb 2012 Posts: 895 Location: Akron, OH
|
Posted: 08 Sep 2012 11:13:04 am Post subject: |
|
|
| KermMartian wrote: | | I suspect it might be slightly faster to do it that way. Can you use the zmg.ticks() function wrapped around 1000 calls of some function written both ways to see what the relative speeds are? |
well, sure, but could I can't get any lua progs to work for me. Maybe it has something to do with me using linux line breaks or me using linux formats? I think mine is in UTF-8... _________________

 
 |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55759 Location: Earth, Sol, Milky Way
|
Posted: 08 Sep 2012 11:33:04 am Post subject: |
|
|
Ah, UTF-8 is encoding, it doesn't understand UTF-8. Try ANSI encoding. _________________
 |
|
| Back to top |
|
|
flyingfisch

Super-Expert

Joined: 02 Feb 2012 Posts: 895 Location: Akron, OH
|
Posted: 08 Sep 2012 11:40:59 am Post subject: |
|
|
Oh, ok. _________________

 
 |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55759 Location: Earth, Sol, Milky Way
|
Posted: 08 Sep 2012 11:49:06 am Post subject: |
|
|
| vebveb wrote: | Yes, it faster:
[...]Then if we call a function multiple times, the first way is faster. | I just tried an experiment with the following code:
Code: local point = zmg.drawPoint
local start = zmg.ticks()
for j=1,1000,1 do
point(64,64,0x6421)
end
print((zmg.ticks()-start)/(64*1000))
start = zmg.ticks()
for j=1,1000,1 do
zmg.drawPoint(64,64,0x6421)
end
print((zmg.ticks()-start)/(64*1000))
The former method averaged 0.000125 seconds (125 microseconds) per call, while the latter method averaged 0.000141 seconds (141 microseconds) per call. A small but measurable difference, which would be amortized for more complex calls than drawPoint. _________________
 |
|
| Back to top |
|
|
flyingfisch

Super-Expert

Joined: 02 Feb 2012 Posts: 895 Location: Akron, OH
|
Posted: 08 Sep 2012 12:09:35 pm Post subject: |
|
|
Is there an implemented text input routine for LuaZM? _________________

 
 |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55759 Location: Earth, Sol, Milky Way
|
|
| Back to top |
|
|
flyingfisch

Super-Expert

Joined: 02 Feb 2012 Posts: 895 Location: Akron, OH
|
Posted: 08 Sep 2012 12:13:57 pm Post subject: |
|
|
Oh, cool.
Why don't you import the io standard library instead of adding it to zmg?
EDIT:
Just looked at the docs. I didn't mean to draw text, i meant to get user input from the command line. _________________

 
 |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55759 Location: Earth, Sol, Milky Way
|
Posted: 08 Sep 2012 12:21:05 pm Post subject: |
|
|
| flyingfisch wrote: | Oh, cool.
Why don't you import the io standard library instead of adding it to zmg?
EDIT:
Just looked at the docs. I didn't mean to draw text, i meant to get user input from the command line. | Those are going to be part of the io library. print() prints to the command line for now, but there's no read() or readline() function yet. _________________
 |
|
| Back to top |
|
|
|
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.
» Go to Registration page
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.043067 seconds.
|