Plua
   HOME

TheInfoList



OR:

Plua is a port of the
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
Lua 5.0.3, 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 Brazil, officially the Federative Republic of Brazil, is the largest country in South America. It is the world's List of countries and dependencies by area, fifth-largest country by area and the List of countries and dependencies by population ...
. Plua includes some extensions to Lua to better support the Palm platform. Development has ceased on Plua, and the latest stable version of ''Plua'' 2.0 can only be downloaded from a discussion board.Yahoo Groups: plua
/ref> The prior version, Plua 1.1, is a port of Lua 4.0. The extensions differ somewhat between versions. The new version is thus sometimes called Plua 2 to avoid confusion.


Language resources

Plua has some special functions, or extensions, to support the Palm platform, including: *
Graphical user interface A graphical user interface, or GUI, is a form of user interface that allows user (computing), users to human–computer interaction, interact with electronic devices through Graphics, graphical icon (computing), icons and visual indicators such ...
(GUI) components, defined by position: buttons, checkboxes, etc. * Direct plotting of graphics based on vertex information: lines, circles, etc. * Can work with streams, databases or computer files on memory cards. * Supports communication via
infrared Infrared (IR; sometimes called infrared light) is electromagnetic radiation (EMR) with wavelengths longer than that of visible light but shorter than microwaves. The infrared spectral band begins with the waves that are just longer than those ...
and serial ports. * Rudimentary sprite engine.


Sample code, Plua 1

The
compiler In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
and interpreter is approximately 150 KB, and the compiled helloworldApp.prc shown below is approximately 2 KB. The classic
hello world program Hello is a salutation or greeting in the English language. It is first attested in writing from 1826. Early uses ''Hello'', with that spelling, was used in publications in the U.S. as early as the 18 October 1826 edition of the '' Norwich Cou ...
(in the old version) 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: * Line #1: *: 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. * Line #2: *: Defines the title at the top of the page. * Line #3: *: Prints the message "Hello, world!" onscreen under the title bar. * Line #4: *: 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.


Sample code, Plua 2

The equivalent program with the new extensions can be written as follows: -- HelloWorld.lua gui.title 'Hello world' print 'Hello world!' gui.event(ioPending) A breakdown of the program: The first line comment is the same as before, but the rest is a little different. * Line #2: *: The gui.title function defines the title at the top of the page. Parentheses are optional for a Lua function call with a single string argument (and also for a single table constructor).
String literal string literal or anonymous string is a literal for a string value in the source code of a computer program. Modern programming languages commonly use a quoted sequence of characters, formally "bracketed delimiters", as in x = "foo", where , "foo ...
s may be either single-quoted or double-quoted. * Line #3: *: Prints the message "Hello, world!" onscreen under the title bar. If the optional parentheses and double quotes had been used (and they could have been), this line would be identical to the first version. * Line #4: *: The above command pauses the execution of the programs and waits for any interaction from the user. The argument ioPending is simply a predefined number included in Plua 2 representing a request for this behavior.


See also

* Palm OS Emulator


References


External links


Plua Yahoo group

Plural Plua IDE

Wiki pLua

Plua Revisited
{{Lua programming language Lua (programming language) Palm OS software