Difference between revisions of "CPLua"

From Casio Universal Wiki
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[fr:CPLua]]
 
[[fr:CPLua]]
 +
{{InfoBox Software
 +
| name                = CPLua
 +
| logo                = cpluaicon.png
 +
| logoCaption          = icon
 +
| screenshot          = cplua.jpg
 +
| caption              = Last Version Home
 +
| author              = Orwell
 +
| developer            = Cartix
 +
| latest release      = 28 January 2012
 +
| programming language = Lua
 +
| genre                = IDE
 +
| platform            = Classpad
 +
}}
 
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.
 
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.
  
Line 5: Line 18:
  
 
__TOC__
 
__TOC__
 
  
 
==History==
 
==History==
Line 104: Line 116:
 
* [http://calc-casio.e-monsite.com/pages/librairie/cplua/ User made libraries] (in French)
 
* [http://calc-casio.e-monsite.com/pages/librairie/cplua/ User made libraries] (in French)
 
* [http://orwell01.free.fr/Release/CPLua/functions.txt List of the Specific function]
 
* [http://orwell01.free.fr/Release/CPLua/functions.txt List of the Specific function]
 +
[[Category:Lua]]

Latest revision as of 10:26, May 20, 2014


CPLua
Cpluaicon.png
icon
Cplua.jpg
Last Version Home
AuthorOrwell
DeveloperCartix
Latest release28 January 2012
Programming languageLua
GenreIDE
PlatformClasspad


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.

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

Getting Started

  • First download the version you want : CPLua 0.8 or CPLua 0.10A
  • Then send the .cpa to your classpad with FA-CP1 or Classpad Add-In Installer (tutorial will be avalaible soon)
  • Go to the main menu on your Classpad and open the application CPLua
  • Create a new file and begin to write script.

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
  • Math : This lib allows you to perform arithmetic operation on number (sin, root, ...)

To know all the function of a library, type "table.foreach(<name of the library>,print)"

Control Structures

LOOP Statement

  • You can break a loop with the "break" instruction

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 anything
  • If any parameter are specified, the function will take "nil" as parameter
  • 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

There is also other Classpad specific functions like :

  • keypad(0/1) : 0 to hide the keypad and 1 to show it
  • fullscreen(0/1) : 0 to show the menu and 1 to hide it

To know all the specific function of the Classpad, have a look here

Useful Links