Plua
From Wikipedia, the free encyclopedia
Plua is a port of Lua 4.0 (along with a small IDE) for the Palm Computing platform. Lua is a programming language designed at TeCGraf, the Computer Graphics Technology Group of PUC-Rio, Brazil.
The latest stable version of Plua is 1.1.
[edit] Language resources
Plua has some special functions to support the Palm platform, including:
- UI Components, defined by position: buttons, checkboxes, etc.
- Direct plotting of graphics based on vertex information: lines, circles, etc.
- Able to work with streams, databases or computer files on a memory card.
- Communication via Infrared and serial ports supported.
[edit] Sample Code
The compiler and interpreter is approximately 150KB , and the compiled helloworldApp.prc shown below is approximately 2KB.
The classic hello world program can be written as follows:
-- HelloWorld.lua ptitle("Hello World") print ("Hello, world!") pevent()
This text will be saved as a normal memo in the Palm, and executed by tapping the "Run" button in the IDE. Alternatively, the program can be compiled into a PRC (Palm OS Program File, which is executable on any Palm Platform, provided that the runtime program is present) from the same IDE.
A breakdown of the program:
-- HelloWorld.lua
The double dashes define the above line as a comment. All Plua memo files must be defined as such before it can be run or compiled in Plua.
ptitle("Hello World")
Defines the title at the top of the page.
print("Hello, world!")
Prints the message "Hello, world!" onscreen under the title bar.
pevent()
The above command pauses the execution of the programs and waits for any interaction from the user. These include button taps, character input, or the push of a hard button.
[edit] External links
- Plua Yahoo group port of Lua 5.0
- Plua 1.1 info page
- Another Plua home page