Difference between revisions of "CPLua"
Line 67: | Line 67: | ||
function <function name>(<parameter list>) | function <function name>(<parameter list>) | ||
<code to execute if the function is called> | <code to execute if the function is called> | ||
+ | return <value to return> | ||
end | end | ||
</pre> | </pre> | ||
+ | If return isn't specified, the function won't return anythign | ||
+ | You can declare local variable, wich will be only usable by the function | ||
===COMMENT Statement=== | ===COMMENT Statement=== | ||
Line 75: | Line 78: | ||
--[[<comment>]]-- for a multi-line comment | --[[<comment>]]-- for a multi-line comment | ||
</pre> | </pre> | ||
+ | |||
+ | ==CPLua Specific Functions== | ||
+ | CPLua have to different screen to show : console (for input and output) and graph (for drawing). The default screen is the console. You can switch with : | ||
+ | * showconsole() to show the console screenµ | ||
+ | * showgraph() to show the graph screen |
Revision as of 17:54, June 15, 2012
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.10A version avalaible here.
Contents
[hide]
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
LOOP Statement
While
while <condition 1> do <code to execute while the condition 1 is respected> end
Repeat
repeat <code to execute while the condition 1 is respected> until <condition 1>
For
for <var>=<min>,<max>[,<step>] do <code to execute while var isn't equal to max > end
If step isn't specified, then the step will be 1
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
FUNCTION Statement
function <function name>(<parameter list>) <code to execute if the function is called> return <value to return> end
If return isn't specified, the function won't return anythign You can declare local variable, wich will be only usable by the function
COMMENT Statement
--<comment> for a one-line comment --[[<comment>]]-- for a multi-line comment
CPLua Specific Functions
CPLua have to different screen to show : console (for input and output) and graph (for drawing). The default screen is the console. You can switch with :
- showconsole() to show the console screenµ
- showgraph() to show the graph screen