From bc2a19199ee23eb9c416c8bc4a5553ca3828f8f0 Mon Sep 17 00:00:00 2001
From: scuri
All the IM functions are available in Lua, with a few exceptions. We call it
- ImLua. To use them the general application will do require"imlua",
- and require"imluaxxxx" to all other secondary libraries that are needed. The functions
- and definitions will be available under the table "im" using the following name
- rules:imXxx -> im.Xxx (for functions)
IM_XXX -> im.XXX (for definitions)
imFileXXX(ifile,... -> ifile:XXX(... (for methods)
+ ImLua. To use them the general application will do
+ require"imlua", and require"imluaxxxx" to all other secondary libraries that
+ are needed. The functions and definitions will be available under the table
+ "im" using the following name rules:
imXxx -> im.Xxx (for functions)
IM_XXX -> im.XXX (for definitions)
imFileXXX(ifile,... -> ifile:XXX(... (for methods) imImageXXX(image,... -> image:XXX(... (for methods)
- 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 palettes. - All the metatables have the "tostring" - metamethod implemented to help debuging. The imImage metatable has the "index" metamethod - so you can address its data directly in Lua. Some functions were modified to receive - those objects as parameters.
+ 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 palettes. All the metatables have the + "tostring" metamethod implemented to help debuging. The imImage + metatable has the "index" metamethod so you can address its data + directly in Lua. Some functions were modified to receive those objects + as parameters.- 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.
+ 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.- Notice that, as opposed to C, in which enumeration flags are combined with - the bitwise operator OR, in Lua the flags are added arithmetically.
+ Notice that, as opposed to C, in which enumeration flags are + combined with the bitwise operator OR, in Lua the flags are added + arithmetically.- In Lua -all parameters are checked and a Lua error is emitted when the check fails.
+ In Lua all parameters are checked and a Lua error is emitted when the + check fails.All the objects are garbage collected by the Lua garbage collector.
@@ -48,27 +50,29 @@ all parameters are checked and a Lua error is emitted when the check fails.
- Lua 5.1 "require" can be used for all the ImLua - libraries. You can use require"imlua" and so on, but the LUA_CPATH - must also contains the following: + Lua 5.1 "require" can be used for all the ImLua + libraries. You can use require"imlua" and so on, but the + LUA_CPATH must also contains the following:
-"./lib?51.so;" [in UNIX] +"./lib?51.so;" [in UNIX] -".\\?51.dll;" [in Windows] +".\\?51.dll;" [in Windows]- The LuaBinaries distribution already - includes these modifications on the default search path.
+ The LuaBinaries + distribution already includes these modifications on the default search + path.- The simplest form require"im" and so on, can not be used because there - are IM dynamic libraries with names that will conflict with the names used by require + The simplest form require"im" and so on, can not be used + because there are IM dynamic libraries with names that will conflict + with the names used by require during search.
- Additionally you can statically link the ImLua libraries, but you - must call the initialization functions manually. The + Additionally you can statically link the ImLua + libraries, but you must call the initialization functions manually. The imlua_open function is declared in the header file imlua.h, - see the example below:
+ face="Courier New">imlua.h, + see the example below:@@ -101,17 +105,20 @@ all parameters are checked and a Lua error is emitted when the check fails. Integration with CDLua
-In CDLua there is an additional library providing simple functions to map the +
In CDLua there is an additional library providing simple functions + to map the imImage - structure to the cdBitmap structure. And some facilities to - draw an image in a CD canvas. See also the CD documentation and - the IM Lua 5 Binding reference.
-Color values and palettes can be created and used transparently in both libraries. Palettes and color values are - 100% compatible between CD and IM.
+ structure to the cdBitmap structure. And some facilities to + draw an image in a CD canvas. See also the + CD documentation and the IM Lua 5 + Binding reference. +Color values and palettes can be created and used transparently in both + libraries. Palettes and color values are 100% compatible between CD and IM.
Reference
- See also the ImLua 5 Binding ReferenceImLua 5 Binding + Reference.
-- cgit v1.2.3