Jump to content

Plua

From Alfawiki
Plua
Company typeSoftware
IndustryComputer programming
PredecessorPlua 1.1
DefunctYes
FateDiscontinued
Area served
Palm Computing platform
ProductsPlua 2.0, Plua IDE

Plua represents a port of the Lua 5.0.3 programming language, accompanied by a compact IDE tailored for the Palm Computing platform. Lua originally emerged from TeCGraf, the Computer Graphics Technology Group at the PUC-Rio in Brazil. To enhance compatibility with Palm devices, Plua incorporates additional features extending the base Lua functionality.

The development of Plua has been discontinued; the most recent stable release, known as Plua 2.0, can only be obtained through a community discussion forum. Its predecessor, Plua 1.1, was based on Lua 4.0 and included different sets of extensions compared to the later version. To distinguish between them, the newer iteration is often referred to simply as Plua 2.

Language resources

Plua provides specialized capabilities designed to leverage Palm platform functionalities, including:

  • User interface elements positioned explicitly, such as buttons and checkboxes.
  • Direct rendering of graphic primitives like lines and circles from vertex data.
  • Access to various data sources including streams, databases, and files stored on memory cards.
  • Communication interfaces via infrared and serial connections.
  • A fundamental sprite engine for simple graphical animations.

Sample code, Plua 1

The combined size of the compiler and interpreter is approximately 150 KB; a compiled example application named helloworldApp.prc occupies roughly 2 KB.

An example "Hello World" script in Plua 1 appears as follows:

<syntaxhighlight lang="lua" line>

-- HelloWorld.lua
ptitle("Hello World")
print ("Hello, world!")
pevent()

</syntaxhighlight>

This script can execute as a memo on Palm devices or be compiled into a PRC (Palm OS Program File) executable using the IDE.

Explanation of each line:

  • Line 1: A mandatory comment line for all Plua memos.
  • Line 2: Assigns the title displayed at the top of the screen.
  • Line 3: Outputs the text "Hello, world!" beneath the title bar.
  • Line 4: Halts program execution until user input is detected (such as button presses or other interactions).

Sample code, Plua 2

The corresponding program in Plua 2 utilizes updated extension methods:

<syntaxhighlight lang="lua" line> -- HelloWorld.lua gui.title 'Hello world' print 'Hello world!' gui.event(ioPending) </syntaxhighlight>

Line-by-line description:

  • Line 2: Sets the page header using gui.title; parentheses are optional when passing a single string argument.
  • Line 3: Displays "Hello world!" on the screen.
  • Line 4: Suspends execution awaiting user actions; ioPending is a predefined constant managing this behavior.

See also

External links