Rockbox

  • Status Closed
  • Percent Complete
    100%
  • Task Type Patches
  • Category Plugins
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by Dan Everton - 2008-07-09
Last edited by Maurus Cuelenaere - 2009-05-21

FS#9174 - Lua Scripting Language for Rockbox

Here is an (very, very) early proof of concept Lua viewer plugin (v.5.1.3).

Currently only a few functions are exported from the plugin API and it also lacks a setjmp/longjmp implementation for actual targets so error handling will go wrong very quickly.

However it does work so far for simple scripts like the following:

function sayhello(seconds)

  message = string.format("Hello from LUA for %d seconds", 5)
  rb.splash(seconds, message)

end

– Drawn an X on the screen
rb.clear()
rb.drawline(0, 0, rb.LCD_WIDTH, rb.LCD_HEIGHT)
rb.drawline(rb.LCD_WIDTH, 0, 0, rb.LCD_HEIGHT)
rb.update()

seconds = 5

rb.sleep(5 * rb.HZ)

sayhello(seconds)

Closed by  Maurus Cuelenaere
2009-05-21 19:02
Reason for closing:  Accepted
Additional comments about closing:  

in r21020

Dan Everton commented on 2008-07-09 10:18

I forgot to mention that it’s designed to be used as a viewer of .lua files. So you would save the above example Lua file to test.lua on your target and then play it as you would any other file.

Maurus Cuelenaere commented on 2008-07-09 20:09

Nice patch, works fine on the sim! (can’t test on a device atm)

I’ve added some extra functions to the rb lib (see attached diff)

Jens Erdmann commented on 2009-04-10 13:17

I reworked the patch a bit and make it work in the current tree.

I will test it later on a device but it looked good in sim.

Tony Huynh commented on 2009-04-15 10:05

I’m going to try it out on my c250. Looking forward to future developments =]

Maurus Cuelenaere commented on 2009-04-16 14:37

This is v2 with some more functions added, setjmp implementation and tested on target (Onda VX747 - works!).

Jens Erdmann commented on 2009-04-16 18:32

The current patch also worked good on my e250. :-)

Maurus Cuelenaere commented on 2009-04-16 22:15

* updated to Lua 5.1.4
* added more functions to rocklib
* added ability to use audiobuffer when out of pluginbuffer RAM

Jens Erdmann commented on 2009-04-20 16:37

Are there some open tasks?

Maurus Cuelenaere commented on 2009-04-20 16:39

You mean TODO’s before this gets committed?
AFAIK, this is pretty stable; but I would like to get another dev to confirm that..

Maurus Cuelenaere commented on 2009-04-22 15:07
Maurus Cuelenaere commented on 2009-04-22 22:14

* Fixes issue with line numbers not showing up when error occured
* Adds UNLIKELY & LIKELY

Robert Kukla commented on 2009-04-23 12:44

Nice stuff.

I tried v6 on the gigabeat and it looks as if numbers are not parsed correctly. I.e. the 5 seconds become 1075052544 - maybe to do with the fact that the only numerical datatype in LUA is float. Also the rectangle doesn’t get drawn - I suspect for the same reason.

In the simulator (cygwin) it is worse. To get it to compile I had to make the “int error_no = 0;” unconditional. I didn’t get it to draw anything, but the splash was displayed (with a rather big number).

Jens Erdmann commented on 2009-04-24 23:23

You just missed the viewer.config.
But i got problems running the test script in the simulator.
The screen gets cleaned and nothing else happends.

Maurus Cuelenaere commented on 2009-05-19 22:52

* fixes sim build
* removes strtod
* adds strtol
* should completely remove floating-point support

If this version doesn’t break somewhere/something I’ll probably commit it soon.

Thomas Martitz commented on 2009-05-21 15:28

Why remove floating point support?

Maurus Cuelenaere commented on 2009-05-21 18:11

* adds support for auto-generating ACTION_*
* adds some more wrappers
* adds the current path & /.rockbox/rocks/viewers/ to the search path when including files

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing