Plua

Plua

Plua is a port of 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. Plua includes some extensions to Lua to better support the Palm platform.

The latest stable version of "Plua" is 2.0. [http://meusite.uai.com.br/~mmand/plua/plua.htm] The previous version, Plua 1.1, is a port of Lua 4.0. The extensions differ somewhat between versions. The new version is therefore sometimes called Plua 2 to avoid confusion.

Language resources

Plua has some special functions, or extensions, 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.
* Rudimentary sprite engine.

Sample Code in Plua 1

The compiler and interpreter is approximately 150KB , and the compiled helloworldApp.prc shown below is approximately 2KB.

The classic hello world program (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:

-- 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.

Sample Code in Plua 2

The equivalent program with the new extensions can be written as follows:

-- HelloWorld.luagui.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.

gui.title 'Hello world'

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 literals may be either single-quoted or double-quoted.

print 'Hello world!'

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 identical to the first version.

gui.event(ioPending)

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

External links

* [http://tech.groups.yahoo.com/group/plua Plua Yahoo group]
* [http://meusite.uai.com.br/~mmand/plua/plua.htm "Plua 2.0" info page]
* [http://web.archive.org/web/20070102053819/http://sophonix.com/downloads/plural.asp Plural Plua IDE]


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • Plua — est une adaptation pour plateforme Palm OS du langage de programmation Lua (version 4.0). Spécificités Cette version de Lua comporte quelques fonctions spécifiques aux Palm : des fonctions permettant de créer une interface graphique à… …   Wikipédia en Français

  • plumose — plu·mose || pluːməʊs adj. covered with feathers; resembling a feather …   English contemporary dictionary

  • pluperfect — plu·per·fect || ‚pluː pÉœrfɪkt / pɜː n. grammatical tense which places one past action in relation to another past action (Ex: When you arrived, I had already left. I had left = pluperfect tense) …   English contemporary dictionary

  • plural — plu·ral || plÊŠrÉ™l / plÊŠÉ™rÉ™l n. form of a word that designates more than one referent (Grammar) adj. of many, of more than one …   English contemporary dictionary

  • pluralism — plu·ral·ism || plÊŠrÉ™lɪzm / plÊŠÉ™r n. holding of more than one office; principle of communal life; state of being more than one …   English contemporary dictionary

  • pluralist — plu·ral·ist || plÊŠrÉ™lɪst / plÊŠÉ™r n. advocate of pluralism, one who supports the preservation of individual cultures …   English contemporary dictionary

  • pluralists — plu·ral·ist || plÊŠrÉ™lɪst / plÊŠÉ™r n. advocate of pluralism, one who supports the preservation of individual cultures …   English contemporary dictionary

  • pluralities — plu·ral·i·ty || ‚plÊŠ rælÉ™tɪ n. numerousness, variability; majority of voices in a vote …   English contemporary dictionary

  • plurality — plu·ral·i·ty || ‚plÊŠ rælÉ™tɪ n. numerousness, variability; majority of voices in a vote …   English contemporary dictionary

  • plurals — plu·ral || plÊŠrÉ™l / plÊŠÉ™rÉ™l n. form of a word that designates more than one referent (Grammar) adj. of many, of more than one …   English contemporary dictionary

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”