Difference between revisions of "CPLua"

From Casio Universal Wiki
Jump to: navigation, search
 
(28 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
[[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.
  
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.  
+
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 [http://www.casio-scene.com/downloads.php?do=file&id=533 here].
 +
 
 +
__TOC__
  
 
==History==
 
==History==
Line 10: Line 26:
 
* 09-08-2005 : version 0.51 : correct some bug and add new keyboard
 
* 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
 
* 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 [http://www.casio-scene.com/downloads.php?do=file&id=532 here]
+
* 04-19-2006 : version 0.8 : the faster drawing version of all the CPLua version. Download it [http://www.casio-scene.com/downloads.php?do=file&id=532 here]
 
* 07-27-2007 : version 0.9E : last version made by Orwell (add the ui lib)
 
* 07-27-2007 : version 0.9E : last version made by Orwell (add the ui lib)
Last year, two programmer, me (Cartix) and Bynary_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 [http://www.casio-scene.com/downloads.php?do=file&id=533 here]
+
Last year, two programmer, [http://www.casio-scene.com/member.php?10077-Cartix Cartix] (me) and [http://www.planet-casio.com/Fr/compte/voir_profil.php?membre=binary_man 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 [http://www.casio-scene.com/downloads.php?do=file&id=533 here]
  
==Lybrary==
+
==Getting Started==
 +
* First download the version you want : [http://www.casio-scene.com/downloads.php?do=file&id=532 CPLua 0.8] or [http://www.casio-scene.com/downloads.php?do=file&id=533 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
 
* 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====
 +
<pre>
 +
while <condition 1> do
 +
<code to execute while the condition 1 is respected>
 +
end
 +
</pre>
 +
 +
====Repeat====
 +
<pre>
 +
repeat
 +
<code to execute while the condition 1 is respected>
 +
until <condition 1>
 +
</pre>
 +
 +
====For====
 +
<pre>
 +
for <var>=<min>,<max>[,<step>] do
 +
<code to execute while var isn't equal to max >
 +
end
 +
</pre>
 +
* If step isn't specified, then the step will be 1
 +
 +
===IF Statement===
 +
<pre>
 +
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
 +
</pre>
 +
 +
===FUNCTION Statement===
 +
<pre>
 +
function <function name>(<parameter list>)
 +
<code to execute if the function is called>
 +
return <value to return>
 +
end
 +
</pre>
 +
* 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===
 +
<pre>
 +
--<comment> for a one-line comment
 +
--[[<comment>]]-- for a multi-line comment
 +
</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
 +
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 [http://orwell01.free.fr/Release/CPLua/functions.txt here]
 +
 +
==Useful Links==
 +
* [http://www.lua.org/ Lua official website]
 +
* [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]
 +
[[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