diff options
Diffstat (limited to 'html/en/cdlua.html')
-rw-r--r-- | html/en/cdlua.html | 76 |
1 files changed, 42 insertions, 34 deletions
diff --git a/html/en/cdlua.html b/html/en/cdlua.html index 750081b..e3409c0 100644 --- a/html/en/cdlua.html +++ b/html/en/cdlua.html @@ -1,8 +1,9 @@ -<html> +<html> <head> <meta http-equiv="Content-Language" content="en-us"> <title>Lua Binding</title> +<meta http-equiv="Content-Type" content="text/html; charset=us-ascii"> <link rel="stylesheet" type="text/css" href="../style.css"> </head> @@ -13,52 +14,59 @@ <p> All the CD functions are available in Lua, with a few exceptions. We call it <strong> - CDLua</strong>. To use them the - general application will do require"cdlua", and require"cdluaxxxx" to all other - secondary libraries that are needed. The functions and definitions will be available - under the table "cd" using the following name rules:</p> - <pre>cdXxx -> cd.Xxx (for functions)<br />wdXxx -> cd.wXxx (for WD functions)<br />CD_XXX -> cd.XXX (for definitions)<br />cdCanvasXXX(canvas,... => canvas:XXX(... (for methods)<br /></pre> + CDLua</strong>. To use them the general application will do + require"cdlua", and require"cdluaxxxx" to all other secondary libraries that + are needed. The functions and definitions will be available under the table + "cd" using the following name rules:</p> + <pre>cdXxx -> cd.Xxx (for functions)<br />wdXxx -> cd.wXxx (for WD functions)<br />CD_XXX -> cd.XXX (for definitions)<br />cdCanvasXXX(canvas,... => canvas:XXX(... (for methods)<br /></pre> <p> New functions (without equivalents in C) were implemented to create and - destroy objects that do not exist in C. For instance functions were developed - to create and destroy images, pattern, stipple and palette. All the - metatables have the "tostring" metamethod implemented to help debuging. Some functions were modified to receive those objects as parameters.</p> + destroy objects that do not exist in C. For instance functions were + developed to create and destroy images, pattern, stipple and + palette. All the metatables have the "tostring" metamethod implemented + to help debuging. Some functions were modified to receive those objects + as parameters.</p> <p> - Also the functions which receive values by reference in C were modified. Generally, the values of - parameters that would have their values modified are now returned by the function in the same order.</p> + Also the functions which receive values by reference in C were modified. + Generally, the values of parameters that would have their values + modified are now returned by the function in the same order.</p> <p> - Notice that, as opposed to C, - in which enumeration flags are<i> </i>combined with the bitwise operator OR, in Lua the flags are added arithmetically.</p> + Notice that, as opposed to C, in which enumeration flags are<i> </i> + combined with the bitwise operator OR, in Lua the flags are added + arithmetically.</p> <p> - In Lua all parameters are checked and a Lua error is emitted when the check fails.</p> + In Lua all parameters are checked and a Lua error is emitted when the + check fails.</p> <p> - All the objects are garbage collected by the Lua garbage collector, except - the canvas because there can be different Lua canvases pointing to the same - C canvas. The "tostring" - metamethod of the Lua canvas will print both values, Lua - and C. The equal method will compare the C canvas value.</p> + All the objects are garbage collected by the Lua garbage collector, + except the canvas because there can be different Lua canvases pointing + to the same C canvas. The "tostring" metamethod of the Lua canvas will + print both values, Lua and C. The equal method will compare the C canvas + value.</p> <h3> Initialization</h3> <p> <strong>Lua</strong> 5.1 "require" can be used for all the <strong> -CDLua</strong> -libraries. You can use <b>require</b>"<b>cdlua</b>" and so on, but the LUA_CPATH -must also contains the following: + CDLua</strong> + libraries. You can use <b>require</b>"<b>cdlua</b>" and so on, but the + LUA_CPATH must also contains the following: </p> -<pre>"./lib?51.so;" [in UNIX] +<pre>"./lib?51.so;" [in UNIX] -".\\?51.dll;" [in Windows] +".\\?51.dll;" [in Windows] </pre> -<p>The <a href="http://luabinaries.luaforge.net/">LuaBinaries</a> distribution already includes these modifications on the -default search path.</p> -<p>The simplest form <b>require</b>"<b>cd</b>" -and so on, can not be used because there are CD dynamic libraries with names -that will conflict with the names used by <b>require</b> during search.</p> +<p>The <a href="http://luabinaries.luaforge.net/">LuaBinaries</a> distribution +already includes these modifications on the default search path.</p> +<p>The simplest form <b>require</b>"<b>cd</b>" and so on, can not be used +because there are CD dynamic libraries with names that will conflict with the +names used by <b>require</b> during search.</p> <p> - Additionally you can statically link the <strong>CDLua</strong> libraries, but you must call the initialization functions manually. The <strong> - <font face="Courier New">cdlua_open</font></strong> function is declared in the header file <strong><font face="Courier New">cdlua</font><font size="2" face="Courier New">.</font><font face="Courier New">h</font></strong>, - see the example below:</p> + Additionally you can statically link the <strong>CDLua</strong> + libraries, but you must call the initialization functions manually. The <strong> + <font face="Courier New">cdlua_open</font></strong> function is declared in + the header file <strong><font face="Courier New">cdlua</font><font size="2" face="Courier New">.</font><font face="Courier New">h</font></strong>, + see the example below:</p> <div align="center"> <center> @@ -91,8 +99,8 @@ that will conflict with the names used by <b>require</b> during search.</p> <h3>Exchanging Values between C and Lua</h3> - <p>Because of some applications that interchange the use of CD canvases in Lua and C, we build a - few C functions that are available in "cdlua.h":</p> + <p>Because of some applications that interchange the use of CD canvases in Lua + and C, we build a few C functions that are available in "cdlua.h":</p> <pre>cdCanvas* cdlua_checkcanvas(lua_State* L, int pos); void cdlua_pushcanvas(lua_State* L, cdCanvas* canvas);</pre> |