Rockbox

This is the bug/patch tracker for Rockbox. Click here for more information.

Quick links: Bugs · Patches · Rockbox frontpage

Tasklist

FS#9174 - Lua Scripting Language for Rockbox

Attached to Project: Rockbox
Opened by Dan Everton (safetydan) - Wednesday, 09 July 2008, 12:14 GMT+1
Last edited by Steve Bavin (pondlife) - Thursday, 17 July 2008, 12:15 GMT+1
Task Type Patches
Category Plugins
Status New
Assigned To No-one
Player type All players
Severity Low
Priority Normal
Reported Version current build
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Private No

Details

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

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)
This task depends upon

View Dependency Graph

This task blocks these from closing
FS#9095 - Interpreted programming language(basic?(
Comment by Dan Everton (safetydan) - Wednesday, 09 July 2008, 12:18 GMT+1
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.
Comment by Maurus Cuelenaere (mcuelenaere) - Wednesday, 09 July 2008, 22:09 GMT+1
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)

Loading...