CPLua

From Casio Universal Wiki
Revision as of 16:21, June 15, 2012 by Cartix (talk | contribs)
Jump to: navigation, search

Lua language is just between Basic language and C++. This programming language is simple, flexible and fast. It allow developers to program complexes applications that can’t be programmed with Basic language. CPLua is an Add-In for ClassPad which include a Lua interpreter and many new functions then CPLua allow making some Lua applications directly on the calculator.

CPLua is a project then some bugs can appear. The most stable version is currently 0.8 version. The last version is 0.9D version which include some new tools and functions (including a new library which allow creating an manipulating graphical interface), this version contain probably some bugs then use it carefully by waiting 1.0 release version.


History

CPLua has been started in 2005 by Orwell, a french programer, because there was too much people who said that CPBasic is too slow but they didn't want to learn C++ The first version has been released on 09-01-2005 here.

  • 09-07-2005 : version 0.4 : add the possibility to save and load lua script
  • 09-08-2005 : version 0.51 : correct some bug and add new keyboard
  • 09-27-2005 : version 0.72 : add the totality of the CAS package
  • 04-19-2006 : version 0.8A : the faster drawing version of all the CPLua version. Download it here
  • 07-27-2007 : version 0.9E : last version made by Orwell (add the ui lib)

Last year, two programmer, Cartix (me) and Binary_Man, from Planete Casio, have started to edit the source code, in the aim of adding function. Our first version (CPLua 0.10A) came out on 01-28-2012, and is available here

Library

  • UI : User Interface : This lib allows you tu use the interface of the Classpad (menu, toolbar, ...) in your programs
  • CAS : Computer Algebric System : This lib allows you to use the matematics function of the Main application (diff, intg, solve, ...)
  • Draw : This lib allows you to draw on the screen (point, line, circle, ...) and to use sprite/picture
  • IO : Input/Output : This lib allows you to manipulate the Classpad files (open, write, read, save, ...)
  • String : This lib allows you to make operation on string
  • Debug : This lib allows you to debug your lua script
  • Table : This lib allows you to make operation on table

Control Structures

IF Statement

if <condition 1> then
<code to execute if the condition 1 is respected>
elseif <condition 2> then
<code to execute if the condition 1 isn't respected but the condition 2 is respected>
else
<code to execute if none of the condition (1 and 2) are respected>
end

WHILE Statement

while <condition 1> do
<code to execute while the condition 1 is respected>
end

FOR Statement

for <var>=<min>,<max>,<step> do
<code to execute while var is smaller than max >
end

FUNCTION Statement

function <function name>(<parameter list>)
<code to execute if the function is called>
end

COMMENT Statement

--<comment>