dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Search | Go
Wiki > Main > PluginIndex > PluginLua (r6)

Lua scripting language


This plugin is an interpreter for the Lua language. To quote from the Lua website (, Lua is a “powerful, fast, lightweight, embeddable scripting language”. Select a .lua file in the File Browser to run it. For more information on programming in Lua, please see and

There are a few exceptions/additions to the Lua support in Rockbox:
  • No floating point support.
    • The number type in Lua is usually float, however in the Rockbox implementation it is integer.
  • Non-supported libraries.
    • The coroutine, debug and math libraries are not supported.
  • Partially-supported libraries.
    • The os and package libraries are only partially supported.
  • Additional libraries.
Documentation of the API is still a work in progress, and the API itself is not finalised. For the latest information, see PluginLua?.

Note: Please note that if a script does not provide a way to exit, then the only way to exit will be to reset the player.


The plugin API and some Rockbox C functions are directly exposed in the rb table. Have a look at the source code for more info (like plugin.h and others).

To generate a /rb.txt file containing the keys of the rb object, you can run this code:

rb_obj = {}
for k, v in pairs(rb) do
    local the_type = type(v)..'s'
    if not rb_obj[the_type] then
        rb_obj[the_type] = {}
    table.insert(rb_obj[the_type], k)

local list = {}
for rb_type, rb_table in pairs(rb_obj) do
    table.insert(list, string.format('* %s *', rb_type))
    for _, v in ipairs(rb_table) do
        table.insert(list, v)
    -- jump a line
    table.insert(list, '')
local file ='/rb.txt', "w+")
file:write(table.concat(list, '\n'))


Note that the following example may not be up to date with the current version of the Lua plugin.

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

-- Drawn an X on the screen
rb.lcd_drawline(0, 0, rb.LCD_WIDTH, rb.LCD_HEIGHT)
rb.lcd_drawline(rb.LCD_WIDTH, 0, 0, rb.LCD_HEIGHT)

local seconds = 5

rb.sleep(5 * rb.HZ)


There's also a helloworld example script in SVN, see apps/plugins/helloworld.lua

CategoryPlugin: Lua interpreter [Sansa ClipDONE, Sansa FuzeDONE, Sansa e200DONE, Sansa c200DONE, iPod 1G2GDONE, iPod 3GDONE, iPod 4GDONE, iPod ColorDONE, iPod VideoDONE, iPod MiniDONE, iPod NanoDONE, GigabeatDONE, MR-100DONE, iAudio M5DONE, iAudio X5DONE, H100DONE, H300DONE, H10DONE]
Edit | Attach | Print version | History: r9 | r7 < r6 < r5 < r4 | Backlinks | View wiki text | More topic actions...
r6 - 19 May 2010 - 01:42:27 - JustinHannigan

Parents: PluginIndex
Copyright by the contributing authors.