Lua API#
Introduction#
The D-Series phones provide a Lua 5.2 environment. The basic functions and modules ''bit32'', ''math'', ''string'' and ''table'' are available.
With version 1.4 we've included the following libraries that you can access in your script by using require
. eg: local stringx = require "pl.stringx"
- pl.List
- pl.Map
- pl.MultiMap
- pl.OrderedMap
- pl.Set
- pl.class
- pl.compat
- pl.lexer
- pl.pretty
- pl.strict
- pl.stringx
- pl.tablex
- pl.types
- pl.utils
You can also provide custom libraries, i.e. common code that you can access in all lua-scripts. For this you need to provision the luaLibraries. Per default these already contain a few additional libs that are used by some of our key-templates. They get included via e.g. require "callforward" here.
Live Documentation#
Since 1.4 you can use lua-code to inquire which api functions there are and how they work.
Api-Functions#
Since 1.4 you can use lua-code to inquire which api functions there are and how they work.
Shared state#
We provide tables that share information between different running lua-scripts. This example uses both tables, persisted and shared.
shared#
Use for information that does not require to be restored after reboots. Table that can contain arbitrary data. Please find a very unique name if you place anything here, so you won't ever clash with names from other scripts.
persisted#
Use for information that needs to survive reboots. Table that can contain arbitrary data. Please find a very unique name if you place anything here, so you won't ever clash with names from other scripts.
Examples#
see Examples