::luxinialuacore::
The luxinia lua core contains the most useful utility functions. These
	handle the console, the timercallback and the keyboard / mouse event
	events, the module core and the autodoc system.
--------
{:AutoDoc}
The AutoDoc system creates documentation files from the information
provided from Luxinia and the modulekernel. The AutoDoc class provides
a system that can be extended to create help files that fits your use.

For creating your own documentation, you have to set up a template table.
This table may contain string, tables and functions.


@@

%templates.apiSingleHtmlDoc%
[table] - Template table for creating the HTML API of all native Luxinia classes.
--------
%templatePages.moduleHtmlDoc%
[table] - Template table for creating the HTML API of the modules.
--------
%templatePages%
[table] - contains a number of default templates for creating documentation pages
--------
%templateFunctions.descriptor%
(function):(string classfmt, interfacefmt,childfmt,functionfmt,modulefmt) -
returns a function that can be used in the template system.

* classfmt: the strings $classname,$classparent, $classdescription, $interfacelist, $childlist,
$functionlist in the classfmt string will be replaced by the actual meaning
* interfacefmt: $interfacename
* childfmt: function (class, depth): function that should return a string
* functionfmt: function (fname,description,cleandesc)

--------
%templateFunctions%
[table] - contains a number of default functions that can be used within template pages.
--------
%templates.templatePages.apiHTMLFrameDoc%
[table] - Documentation of api and module pages as frames.
--------
%templates.templatePages.apiDocIndex%
[table] - API documentation in a single file.
--------
%writeDoc%
():(path, table template) - similiar to createDoc, except that the output
is written to files in a given output directory.

--------
%createDoc%
(string doc, table struct):(table template) -
Creates a string from a table that was passed that acts
as a template. The table may contain functions, tables and strings.

The table is converted
to a string that represents the final document. The table is therefore iterated
from 1 to n, where n is the number of number-indexed values in the table.
That means that you can use any kind of keys for storing additional information
that you need during the process. In each iteration,

* Strings are written to the output directly
* Table values are passed as argument to a recursive function call on createDoc
* Functions will be called with the table itself, the api hierarchy, the list of
modules and a table containing all classes with their names as keys. The
function may return itself a table (which is resolved as in the point above) or
a string.

The template may contain strings that are formated like "%file=abc%".
The string "abc" is then used as a key in the table that is additionally
returned. Per default, all output is saved to the key "main" in the table, as
long as no such instruction is used. You can use the created table with all
the outputstrings to write it to a file or another structure.

--------
%templateFunctions.hierarchylist%
(function):(string format, string sublistfmt, [boolean api]) - returns a
function that returns a string of a hierarchical listing of all class in a list
form. If api is true, the apihierarchy is used, if its false or not used,
the modulehierarchy is used.

The passed string is used for each element in the list, the sublistfmt is
used for childs in the hierarchy.

* $name is replaced by the name of the element or (in the sublistfmt) with the
childlist of the element.
* $ifinterface=xyz$; will show xyz if the class is an interface class
* $list will insert the sublist in the sublistfmt

--------

--------
{:AutoTable}
The AutoTable class provides a constructor for a table that offers a simple way to insert new values. Although the AutoTable object is a lua table that can be used like any normal table, you can use the table like a function. Any provided argument is inserted at the end of the table. In any case, the number of elements of the table is returned.
@@


--------
{:ClassInfo}
There are two systems in luxinia that describe the classes and their
information: The fpubclass class of the the c core and the LuxModule class
that is written in lua. While the fpubclass takes care about all C classes,
the LuxModule class handles all classes that are written in Lua or are
imported via DLLs. The ClassInfo class trys to provide a minimalistic
access on both systems for returning classnames or their functions and
descriptions without distinguishing between the origin of the class.

@@

%getFunctionDescription%
(string name):(string classname, functionname) - Returns the description
		for the function of the given name of the given classname.
--------
%getClassDescription%
(string description):(string classname) - Returns the dedscription for
		a class of the given name
--------
%getClassName%
(string name):(table/userdata object) - returns the classname of the
		given datavalue if possible or nil.
--------
%getFunctionList%
(table functiondescriptions):(string classname) - Returns a table
		where each key is a functionname and the value is the description for
		the class. This includes also all functions of the interfaces or
		parent classes of the class.
--------

--------
{:Compat}
Compat is a class that provides compatibility functions for previous 
		releases of Luxinia. The changes to the last released developer version are
		automatically applied. Else load compatibility manually. Sometimes backwards compatibility cannot be achived.
@@

%setcompatibility%
():(string version) - sets compatibility for the given version string e.g "0.91f" 
--------

--------
{:CyclicQueue}
The CyclicQueue is a utility class for storing cyclic fields. This is usefull for creating histories. The index operator ([]) can be used to index the queue. I.e. mylist[1] will always return the elment that was inserted last.
@@

%pop%
([value]):(CyclicQueue) - pops a value from the queue. If no element is in the list, nothing is returned
--------
%top%
([value]):(CyclicQueue) - returns the latest inserted element
--------
%push%
():(CyclicQueue,value) - pushes a value on the list.
--------
%overwrite%
{[boolean]} - if false, an exception is thrown if the list is full
--------
%size%
{[int]} - size of the list
--------
%start%
{[int]} - position of current element
--------
%history%
{[table]} - the table containing the entries
--------
%count%
{[int]} - number of entries in list
--------
%new%
(CyclicQueue):(int size, [boolean overwrite]) - Creates a CyclicQueue object of given size. If overwrite is false (default), an error is thrown if the array is full.
--------

--------
{:DebugOutput}
A few helpers to print text on screen quickly.
			The output has 10 slots that you can use to print text out. 
			
			Example:
			 DebugOutput.enable(true)
			 DebugOutput.set(1,string.format("a = %.2f",math.pi))
			
			This will print pi as text on the screen. This is useful i.e. if
			you try to figure out good values for angles, rotations, velocities, 
			etc. during runtime. 
@@


--------
{:ExtMath}
The Extended Math class contains some generic math operations. Vectors and 
		matrices are passed as indexed tables from 1-3 or 1-16. Matrices are stored column-major. 
		Compared to the Luxinia CoreApi functions, the operations here are written and processed entirely in Lua
@@

%interpolate%
(float):(float fraction,float from, float to) - returns interpolated value between from and to
--------
%v4sub%
(table difference):(table a,b) - returns subraction a - b
--------
%v3cross%
(table vector):(table a, b) - returns cross product of 3d vector a and b
--------
%v3scaledadd%
(table out):(table a,table b,float f) - returns a + (b * f)
--------
%v3dot%
(float dot):(table v1, v2) - returns dotproduct for 2 3vectors
--------
%v3add%
(table sum):(table a,b) - returns addition a + b
--------
%v4add%
(table sum):(table a,b) - returns addition a + b
--------
%nearestpowerof2%
(number):(number) - calculates the nearest positive power of 2 number
--------
%v3sqdist%
(float sqdist):(table v1,v2) - return square distance |(v1-v2)|² of vectors
--------
%v3polar%
(floar x,y,z):(float len,planeangle,heightangle) - converts polar coords to regular x,y,z
--------
%v3dist%
(float sqdist):(table v1,v2) - return distance |(v1-v2)| of vectors
--------
%v3sub%
(table difference):(table a,b) - returns subraction a - b
--------
%quatslerp%
(tabel qout):(number fracc, table q1, q2) - returns quaternion spherical interoplation
--------
%v4spline%
(table):(float fraction, table prevfrom, table from, table to, table nextto) - returns catmull-rom spline interpolated vector between from and to
--------
%v3axisrotate%
(table point):(table axis,number angle, table vec) - rotates vector vec around angle of the given axis
--------
%v4mul%
(table out):(table a,b) - returns componentwise multiplication a * b
--------
%anglediff%
(angle):(radians1, radians2) - calculates the shortest angledifference between two angles (which is a bit tricky i.e. -Math.PI - Math.PI == 0)
--------
%v4div%
(table out):(table a,b) - returns componentwise multiplication a / b
--------
%v3div%
(table out):(table a,b) - returns componentwise multiplication a / b
--------
%v3len%
(float len):(table vec) - euklid length of vecotr (a²+b²+c²)^0.5
--------
%v4scaledadd%
(table out):(table a,table b, float f) - returns a + (b * f)
--------
%v3mul%
(table out):(table a,b) - returns componentwise multiplication a * b
--------
%v3sqlen%
(float len):(table vec) - square distance. This function is a little bit 
	faster than the len function which returns the squareroot of this function.
	If you only want to compare distances (i.e. is this point inside my distance),
	you can square the distance you would like to compare with. This is worth 
	the effort since it does not make much difference in code and work.
--------
%v3interpolate%
(table):(float fraction,table from, table to) - returns interpolated vector between from and to
--------
%v4interpolate%
(table):(float fraction,table from, table to) - returns interpolated vector between from and to
--------
%v3spline%
(table):(float fraction, table prevfrom, table from, table to, table nextto) - returns catmull-rom spline interpolated vector between from and to
--------
%v3normalize%
(table normalized,float origlength):(table vec) - returns normalized 
	vector 3d vector and the original length of the vector
--------
%v4scale%
(table out):(table a,float f) - returns component wise a * f
--------
%v3scale%
(table out):(table a,float f) - returns component wise a * f
--------
%nextpowerof2%
(number):(number) - calculates the next positive power of 2 number
--------
%spline%
(float):(float fraction,float prevfrom, float from, float to, float nextto) - returns catmull-rom spline interpolated value between from and to
--------

--------
{:FileSystem}
Luxinia used an internal way to gain access to the directory 
			structures that was located in the luxinia.dir function that 
			was undocumented. The function returned a table of filenames. 
			For plattformindependance and other reasons, we decided to use 
			the Lua File System which is part of the Kepler project 
			(http://www.keplerproject.org/luafilesystem/). You can use the 
			lfs lib or this class. This class is a pure wrapper for the 
			lfs lib and provides only additional documentation in the way 
			the other classes are described. The function descriptions are 
			extracts from the lfs documentation that can be found at the 
			given link.
@@

%touch%
([boolean success],[string error]):(string filepath [, atime [, mtime] ]) -
	Set access and modification times of a file. This function is a bind to 
	utime function. The first argument is the filename, the second argument 
	(atime) is the access time, and the third argument (mtime) is the 
	modification time. Both times are provided in seconds (which should be 
	generated with Lua standard function os.date). If the modification time 
	is omitted, the access time provided is used; if both times are omitted, 
	the current time is used.

	Returns true if the operation was successful; in case of error, it returns 
	nil plus an error string.
--------
%dir%
([function iterator], [string error]):(string path) - 
	Lua iterator over the entries of a given directory. Each time the 
	iterator is called it returns a string with an entry of the directory; 
	nil is returned when there is no more entries. Raises an error if path 
	is not a directory.
--------
%unlock%
([boolean success],[string error]):(filehandle[, start[, length] ]) -
	Unlocks a file or a part of it. This function works on open files; the 
	file handle should be specified as the first argument. The optional 
	arguments start and length can be used to specify a starting point and its 
	length; both should be numbers.

	Returns true if the operation was successful; in case of error, it returns 
	nil plus an error string. 
--------
%currentdir%
([string dir], [string error]):() - Returns a string with the current 
	working directory or nil  plus an error string.
--------
%isDir%
(boolean isdir):(file) - return true if the given file is an directory
	
--------
%lock%
([boolean success], [string error]):(filehandle, mode[, start[, length] ]) -
	Locks a file or a part of it. This function works on open files; the file 
	handle should be specified as the first argument. The string mode could be 
	either r (for a read/shared lock) or w (for a write/exclusive lock). The 
	optional arguments start and length can be used to specify a starting point 
	and its length; both should be numbers.

	Returns true if the operation was successful; in case of error, it returns 
	nil plus an error string.
--------
%attributes%
	([mixed attributevalues]):(string filepath, [string attributename]) - 
	Returns a table with the file attributes corresponding to filepath (or nil 
	followed by an error message in case of error). If the second optional 
	argument is given, then only the value of the named attribute is returned 
	(this use is equivalent to lfs.attributes(filepath).aname, but the table is 
	not created and only one attribute is retrieved from the O.S.). The 
	attributes are described as follows; attribute mode is a string, all the 
	others are numbers, and the time related attributes use the same time 
	reference of os.time:

	* dev: on Unix systems, this represents the device that the inode resides on. 
		On Windows systems, represents the drive number of the disk containing the file
	* ino: on Unix systems, this represents the inode number. On Windows systems 
		this has no meaning mode string representing the associated protection 
		mode (the values could be file, directory, link, socket, named pipe, 
		char device, block device or other)
	* nlink: number of hard links to the file
	* uid: user-id of owner (Unix only, always 0 on Windows)
	* gid: group-id of owner (Unix only, always 0 on Windows)
	* rdev: on Unix systems, represents the device type, for special file inodes. 
		On Windows systems represents the same as dev
	* access: time of last access
	* modification: time of last data modification
	* change: time of last file status change
	* size: file size, in bytes
	* blocks: block allocated for file; (Unix only)
	* blksize: optimal file system I/O blocksize; (Unix only) 
	
--------
%mkdir%
([boolean success],[string error]):(string dirname) -
	Creates a new directory. The argument is the name of the new directory.
	Returns true if the operation was successful; in case of error, it returns 
	nil plus an error string.
--------
%chdir%
([boolean success], [string error]):(path) -
	Changes the current working directory to the given path.
	Returns true in case of success or nil plus an error string.
--------
%rmdir%
([boolean success],[string error]):(string dirname) -
	Removes an existing directory. The argument is the name of the directory.
	Returns true if the operation was successful; in case of error, it returns 
	nil plus an error string.
--------

--------
{:GroupArray}
	A grouparray is an array that groups a couple of elements
	and behaves like one of them. This will only be done for 
	pure indexed array of this group, not for named arrays 
	(arrays that elements are indexed by numbers).
	
	This class is experimental.
	
	!!!Example:
	
	 test = GroupArray.new({
	   l2dtext.new("test","test",0),
	   l2dtext.new("test","test",0),
	 })
	
	 test:color(0,0,0,1)

	!!!Result:
	
	both l2dtext elements will be colored black. The call will return 
	a list of all results grouped in tables.
	
	
@@

%new%
(GroupArray):(table atable,[boolean docopy]) -
	returns a GroupArray of the given table. It does nothing more than 
	setting the table's metatable to the GroupArray table. If docopy 
	is true, the given array is copied.
--------
%get%
([value]/[...]):(GroupArray,[index]) - calls rawget if index is supplied,
	otherwise it returns all numbered elements of the array.
--------

--------
{:Hashspace}
A hashspace stores data paired with positional information in order
		to accelerate requests for data within a certain area. 
		
		This hashspace is implemented in lua and is restricted to 2D spaces 
		and rectangular areas,
		which means that only two coordinates can be used to store the data.
		
		The structure is - even though it is implemented in lua only - quite
		fast. If you have complex environments but don't want to use ODE for 
		collision detection, you can use this class. It is very easy to use and
		can manage thousands of objects cheaply. You can even remove items 
		from the space and reinsert them somewhere else while the costs for 
		doing that are cheap.
		
		!Example
		
		 space = Hashspace.new() -- create hashspace
		 space:add("pawn1",5,4,10,10) -- insert pawn at 5,4 with size 10,10
		 space:add("pawn2",15,6,10,10) -- insert pawn at 15,6 with size 10,10
		 environment = Hashspace.new() -- create a hashspace for the environment
		 for i=1,100 do
		   -- insert now lots of small boxes scattered around randomly
		   environment:add("obstacle "..i,math.random()*100,math.random()*100,4,4)
		 end
		 space:test(environment, -- test the playerspace against the environment
		   function (a,b) -- function is called if two items from each space intersects
		     print(a,b) -- print out intersecting items
		   end)
		
		!Output
		The result from the test above (may differ from other results due to different
		random number generation):
		 obstacle 4   pawn2
		 obstacle 6   pawn2
		 obstacle 23  pawn1
		 obstacle 29  pawn1
		
		 
@@

%remove%
():(Hashspace, item) - removes a certain item from the hashspace. 
	This can be used if an object has moved over the time and the 
	rectangle has to be updated in the hashspace. If you have lots of objects
	in a hashspace and only few are changing their position, you shouldn't rebuild
	the space from scratch (which might be more efficient if lot's of data has changed)
	but remove the item and reinsert it again. As this is still somewhat 
	expensive, you could also prefer to insert your items with a slightly larger
	rectangle and make an exact collisiontest for the hitlists yourself and update
	the rectangle only if the object has moved a larger distance. It improves 
	speed alot if you chose rectangles that are 10% larger if it helps to reduce
	the number of removes and add calls per frame for about 1:10. 
--------
%test%
():(Hashspace self, Hashspace otherspace, fncallback) - 
	Tests two hashspaces against each other and call the callback function in
	case of intersection with both intersecting items (function (a,b)). 
	Testing two hashspaces against each other is much more efficient than 
	doing all the requests by calling the get function. If you have more requests
	to do, you should batch all requests in another hashspace and test it then
	with the other space. However, if both structures must be built from scratch,
	the get function will be a little bit faster. It only pays out if at least 
	one of both structures has been built before anyway.
	
	If two spaces are tested, all items will be only be tested once against 
	each other. However, if both spaces are the same space (for testing 
	intercollisions), you have to ignore selfintersection of an item which 
	will occur then.
	
--------
%new%
(Hashspace):([gridsize = 2]) - Creates a hashspace structure. The gridsize
	determines the minimum size of the cells in the space - which cannot be 
	smaller than that. If your objects and coordinates are much smaller (i.e. 0.01),
	you should pass another size which fits the average sizes in your case better.
	The hashspace works well if the gridsize is somewhere between the minimum and
	average size of all your objects in your environment.
--------
%get%
(table) : (Hashspace,centerx,centery,width,height,[appendtable = {}]) - 
	rectangular request 
	to the hashspace. It will return a list of all items that are intersecting
	this area. If the appentable is passed, the items will be appended to that
	list. This is useful if you have multiple spaces and test them each for 
	an area, creating a single list.
	
	 list = space:get(2,4,10,6) -- request area is at 2,4 with width/height=10,6
	 for i,item in ipairs(list) do -- iterate all items
	   print(item) -- print out intersecting items
	 end
	
--------
%add%
():(Hashspace, item, centerx,centery,width,height) - 
	inserts item (which can be any type) into the hashspace at the given coordinates.
	The given rectangle will be used if an intersection case is tested.
	
	Reinserting an element if it is already present in the space will throw an 
	error. Make sure it does not exist in that space before adding it!
--------

--------
{:KeyEvent}
Keyevents are produced if the use types a key.
@@

%keycode%
{[int]} - code of the key that was typed
--------
%KEY_RELEASED%
[int] - constant if key was released
--------
%KEY_TYPED%
[int] - constant if key was typed
--------
%STATENAMES%
[table] - a list with names for constants
--------
%state%
{[int]} - state of the button (KEY_PRESSED,...)
--------
%KEY_PRESSED%
[int] - constant if key was pressed
--------
%toString%
(string):(KeyEvent) - returns simple string representation
--------
%since%
{[int]} - frameid since when the key is hold down
--------
%key%
{[string]} - key that was typed
--------
%new%
(KeyEvent):(string key, int keycode, int since, int state) -
			creates a new KeyEvent with the given parameters.
--------

--------
{:KeyListener}
A Keylistener receives keyevent callbacks on KeyEvents that are
	produced by a specific component.
@@

%1%
{[function]} - function that is called
--------
%3%
{[boolean]} - if true, function is called on pressed
--------
%2%
{[boolean]} - if true, function is called on releases
--------
%4%
{[boolean]} - if true, function is called on types
--------
%new%
(KeyListener):(function callback, boolean onType,
		onPress, onRelease) - creates a keylistener that calls the callback
		function if the Keyeventtype matches the given filter.

		Callbackfunction signature:
		 function listener (KeyListener, KeyEvent)
	
--------

--------
{:Keyboard}
	The Keyboard class handles events from the input class of the luxinia
	core classes. It provides a system for callbackmechanisms and other
	utility functions.
	
@@

%removeAllKeyBindings%
():() - removes all keybindings 
--------
%keycode.Q%
[int] - q key keycode
--------
%keycode.DEL%
[int] - del key keycode
--------
%keycode.F8%
[int] - f8 key keycode
--------
%keycode.N%
[int] - n key keycode
--------
%keycode.W%
[int] - w key keycode
--------
%keycode.Y%
[int] - y key keycode
--------
%isKeyDown%
(boolean isdown):(int/string code) - this is the same function as input.isKeyDown.
	It is only included here for consistence. This method is insensitive to
	modifier keys such as SHIFT or ALT. If you poll your keycodes for game actions
	you should use this method.

	The function accepts either the numerical keycode as used in the Keyboard.keycode
	table or the nameentry in Keyboard.keycode (i.e. "LSHIFT").

	This function also handles "CTRL" and "SHIFT" as special codes - since
	the left and right shift / ctrl keys are different keys and must
	be polled each - however, if you just pass these strings as arguments,
	the function will return true if either the left or right key is
	pressed.

	Since 0.93a, this function is case insensitive.
--------
%keycode.B%
[int] - b key keycode
--------
%keycode.F4%
[int] - f4 key keycode
--------
%keycode.7%
[int] - 7 key keycode
--------
%keycode.BACKSPACE%
[int] - backspace key keycode
--------
%keycode%
[table] - List of keycode constants
--------
%keycode.L%
[int] - l key keycode
--------
%keycode.I%
[int] - i key keycode
--------
%keycode.HOME%
[int] - home key keycode
--------
%keycode.F11%
[int] - f11 key keycode
--------
%keycode.NUM5%
[int] - num5 key keycode
--------
%keycode.ALT%
[int] - alt key keycode
--------
%keycode.F%
[int] - f key keycode
--------
%keycode.ENTER%
[int] - enter key keycode
--------
%keycode.2%
[int] - 2 key keycode
--------
%keycode.G%
[int] - g key keycode
--------
%keycode.PAGEDOWN%
[int] - pagedown key keycode
--------
%keycode.LEFT%
[int] - left key keycode
--------
%keycode.NUM1%
[int] - num1 key keycode
--------
%keycode.1%
[int] - 1 key keycode
--------
%keycode.RCTRL%
[int] - rctrl key keycode
--------
%keycode.NUM7%
[int] - num7 key keycode
--------
%keycode.MINUS%
[int] - minus key keycode
--------
%keycode.NUM8%
[int] - num8 key keycode
--------
%keycode.PLUS%
[int] - plus key keycode
--------
%keycode.A%
[int] - a key keycode
--------
%keycode.F12%
[int] - f12 key keycode
--------
%keycode.5%
[int] - 5 key keycode
--------
%keycode.LCTRL%
[int] - lctrl key keycode
--------
%keycode.NUMDIV%
[int] - numdiv key keycode
--------
%removeKeyListener%
():(KeyListener listener) - removes keylistener from the listener list
--------
%keycode.END%
[int] - end key keycode
--------
%keycode.M%
[int] - m key keycode
--------
%keycode.F2%
[int] - f2 key keycode
--------
%keycode.E%
[int] - e key keycode
--------
%keycode.R%
[int] - r key keycode
--------
%keycode.NUM0%
[int] - num0 key keycode
--------
%keycode.NUMMINUS%
[int] - numminus key keycode
--------
%keycode.4%
[int] - 4 key keycode
--------
%keycode.X%
[int] - x key keycode
--------
%keycode.8%
[int] - 8 key keycode
--------
%addKeyListener%
():(KeyListener listener) - adds the keylistener to the listener list
--------
%keycode.P%
[int] - p key keycode
--------
%keycode.F7%
[int] - f7 key keycode
--------
%keycode.6%
[int] - 6 key keycode
--------
%keycode.F6%
[int] - f6 key keycode
--------
%keycode.NUM2%
[int] - num2 key keycode
--------
%keycode.DOWN%
[int] - down key keycode
--------
%keycode.UP%
[int] - up key keycode
--------
%keycode.C%
[int] - c key keycode
--------
%keycode.U%
[int] - u key keycode
--------
%keycode.J%
[int] - j key keycode
--------
%keycode.T%
[int] - t key keycode
--------
%keycode.F9%
[int] - f9 key keycode
--------
%keycode.D%
[int] - d key keycode
--------
%keycode.3%
[int] - 3 key keycode
--------
%keycode.V%
[int] - v key keycode
--------
%keycode.SPACE%
[int] - space key keycode
--------
%keycode.NUM4%
[int] - num4 key keycode
--------
%keycode.0%
[int] - 0 key keycode
--------
%keycode.NUMCOMMA%
[int] - numcomma key keycode
--------
%keycode.NUM3%
[int] - num3 key keycode
--------
%removeKeyBinding%
():(int keycode/string keycode) - removes keybinding for this key
--------
%keycode.H%
[int] - h key keycode
--------
%keycode.ESC%
[int] - esc key keycode
--------
%keycode.LSHIFT%
[int] - lshift key keycode
--------
%keycode.NUM9%
[int] - num9 key keycode
--------
%keycode.NUMMUL%
[int] - nummul key keycode
--------
%keycode.O%
[int] - o key keycode
--------
%keycode.S%
[int] - s key keycode
--------
%keycode.ALTGR%
[int] - altgr key keycode
--------
%keycode.NUMPLUS%
[int] - numplus key keycode
--------
%keycode.NUM6%
[int] - num6 key keycode
--------
%keycode.INS%
[int] - ins key keycode
--------
%keycode.PAGEUP%
[int] - pageup key keycode
--------
%keycode.RIGHT%
[int] - right key keycode
--------
%keycode.Z%
[int] - z key keycode
--------
%keycode.K%
[int] - k key keycode
--------
%keycode.F5%
[int] - f5 key keycode
--------
%keycode.F3%
[int] - f3 key keycode
--------
%keycode.TAB%
[int] - tab key keycode
--------
%keycode.F10%
[int] - f10 key keycode
--------
%keycode.F1%
[int] - f1 key keycode
--------
%keycode.RSHIFT%
[int] - rshift key keycode
--------
%setKeyBinding%
():(int/string keycode, [function, [int delay] ]) - adds keybinding for this
	key and calls the given function every delay milliseconds while the key is
	pressed. The keycode can be a string that describes the key same as the
	keycode names (i.e. "W" or "DEL"). If only a keycode is provided, the
	keybinding is removed.
--------
%getPressedKeys%
([table keys,codes]):() - returns two tables: One with all pressed keynames and
		one with the keycode values. This only includes keys that are listed in the
		keycode table of the Keyboard class. It is also a slow method since it polls
		every keycode one by one.
--------

--------
{:LuaConsole}
The console is a programming and debugging tool within the runtime environment of Luxinia. The LuaConsole provides interactive access on Luxinia.
@@

%lastinput%
[AutoTable] - The last line of input the user made before started scrolling through the history.
--------
%lines%
[CyclicQueue] - A cyclic array object obtained from the CyclicQueue class. Stores 1000 lines per default.
--------
%cursor%
[int] - position of inputcursor, must be >0 and <= size of input + 1.
--------
%setConsolePlugin%
(any key):(function fn) - Add a pluginfunction to the console. All.
		Plugins are being executed at the end of a drawcycle which means that
		additional characters can be set on the console, i.e. interactive help.
--------
%inputHistory%
[CyclicQueue] - cyclic array with defaultsize = 1000 of all user (successful) inputs he made.
--------
%inputModified%
[boolean] - True if the input was changed by user, so the input must be stored in 'lastinput'
--------
%runningApplication%
[table] - currently running consoleapplication.
--------
%browseHistory%
[int] - position where the user is in history
--------
%applications%
[table] - table of all consoleapplications.
--------
%activeplugins%
[table] - table of all plugin functions.
--------
%input%
[AutoTable] - A 'normal' table that is obtained from the AutoTable class. Represents userinput as array
--------
%scrollLine%
[int] - position in output display.
--------

--------
{:LuxModule}
LuxModules are luascripts that are
	part of the official Luxinia distribution. LuxModules are not related to
	the module and package system of lua. LuxModules are creating lot's of
	global functionnames, so watch out for problems for namespaces.

	LuxModules are extending the luxinia API with addtitional scripts for
	simplified use. In difference to the native API of Luxinia, modules are implemented
	within the scripting of Luxinia. LuxModules extend Luxinia with functions and classes
	that are simpler to use than the native API functions. This means that you can modify
	the modules, but you should always keep in mind that Luxinia can and should be used
	for different projects and maybe not only for your own projects. Changing the official
	scripts may cause problems with other projects that are not written by you into. Even
	worse, changes on the official scripts can will need you to update your modified scripts, too.<br>
	However, you may write your own modules that fits into the modulestructure of Luxinia.
	By doing so, you can extend Luxinia in a way that other can easily use, too. 
@@

%getclasses%
(table classes):(string modulename) - Returns the classes as a table. This prevents overriding previously defined global variables as described in 'load'. I.e. if a LuxModule named 'foo' is loaded and it contains the classes 'a' and 'b', the returned table contains the two classes 'a' and 'b'.
--------
%getLuxModuleDescription%
([string]):(string modulename) - return description of LuxModule
--------
%register%
():(string modulename, string description) - Registers a modulename as LuxModule. The description should explain what the whole LuxModule is good for.
--------
%registerclassfunction%
():(string modulename,string classname,string functionname,string description) - sets a functiondescription for a function of a class.
--------
%getclassinfo%
():(string modulename, string classname) - returns all known information on a class of a LuxModule
--------
%load%
():(string modulename) - Puts all the classes that belong to the LuxModule into the global variable space. I.e. if a LuxModule has a certain class that's name is 'foo', the class can be used from now on by simply using the name 'foo'. This can of course override your own tables or even classes of other modules. If this is a problem to you, you can use getclasses instead, which returns a table of classes.
--------
%setLuxModuleDescription%
():(string modulename, string/function description) -
			sets description of LuxModule
--------
%getclasshierarchy%
(table hierarchy, table allclasses) : (string modulename) - returns a hierarchy in a datastructure that is compatible to the used format in the autodoc.lua file. 
--------
%getClassInfo%
([string name, modulename,description, table functionhelp, string parent, table interfaces]):(table obj/string name) - returns name and modulename of the given class or object if possible. If a string was passed, the name and the modulename is returned if it is a registered class. Additionally, the description of the class and the description of the functions is returned as a table where the keys are the functionnames and the values are the functiondescriptions.
--------
%modulenames%
(table modulenames, int count):() - returns names and number of known modules.
--------
%registerclass%
():(string modulename,string name,
			string/function/table description,
			table class,
			table help, [string parent],[table interfaces], [boolean isthreadsafe],
			[table threadsafefunctions]) -
			registers a class that is part of a certain LuxModule with a certain
			name. The help table should describe each function of the class with
			the functionname as key and a descriptionstring that describes the
			arguments and functiondetails.
			You can optionally define the name
			of the parentclass and the names of the interfaces. This has only a
			hierachical purpose for the documentation.

			If the description is a function, the function is called with the
			modulename and classname as argument. It may return a string or a
			table.

			If the description is a table, it is concatenated to a string.
			
--------

--------
{:LuxiniaParam}
The LuxiniaParam class stores the original list of arguments with which 
luxinia was called. The string of the commandline execution, i.e.:

 luxinia.exe -abc test 1 -f "hello world" --word 13

will be converted in a array that is stored in a global variable named "arg", 
which will look like this:

 arg[1] = "luxinia.exe"
 arg[2] = "-abc"
 arg[3] = "test"
 arg[4] = "1"
 arg[5] = "-f"
 arg[6] = "hello world"
 arg[7] = "--word"
 arg[8] = "13"

The LuxiniaParam class also provides a set of utility functions 
to simplify the processing of commandline options. The arguments with 
which luxinia was called are put into a table that can be accessed and 
modified. I.e. the example above will make create a table structure that 
looks like this:

 env["a"] = {"test","1"}
 env["b"] = {"test","1"}
 env["c"] = {"test","1"}
 env["f"] = {"hello world"}
 env["word"] = {"13"}

You can change values in this table with the given getters and setters.

Additionally, the LuxiniaParam class can help to describe the commandline 
options. 
@@

%addTriggerDescription%
	():(string trigger, string description) - Adds a trigger description to the
	known descriptions. The known descriptions will be listed here. If your 
	trigger description is not listed here, please make sure that the 
	autodocc creation is done right after you have registered the trigger.
	!!!!Known triggers:	
	
	* dbg<br>This parameter will enter in debug mode when the project is being loaded.
* p<br>requires a path argument (i.e. -p c:\project\bla). Sets the
projectpath to the given argument and trys to execute a "main.lua"
file in the given path. The path may be relative or absolute.
"main.lua" is not loaded if -v for the viewer is also set.

* v<br>launches the viewer requires 1 filename (.mtl, .prt, .f3d, .mm) optionally a second (.ma). You can combine it with setting the projectpath and resources will be loaded from there.
* w<br>x y - sets window position
* h<br>prints out all known module trigger descriptions
* d<br>Writes the documentation files.

--------
%setArg%
	([table]):(string name, table newvalue) - sets a new table value for the 
	given triggername. Pass nil to delete the triggername value.
	
--------
%triggerDescriptionIterator%
	(function iterator):() - returns a iterator function that can be used 
	to list all known triggers to this moment. Use it like this:
	
	 for index, trigger, description in LuxiniaParam.iterator() do
	   print(index,trigger,description)
	 end
	
--------
%getOrigArgs%
	(table):() - returns a copy of the original arguments which is stored in 
	a global named "arg". Since the LuxiniaParam module makes a copy of this 
	table during startup, you must not worry about overwriting the original
	argument table suplied by the luxinia core.
	
--------
%getArg%
	([table]):(string name) - returns an argument table for the given 
	triggername.
	
--------

--------
{:OO}
The objectoriented class provides two functions which 
		allows a more objectoriented like design using lua functions.
		
		It implements a simple inheritance model. An object is a table
		with a metatable which includes all class information. 
		
		All functions from this class are available as global variables
		with the same name.
		
		!!Examples:
		
		 class "Foo" -- a simple class
		 print (Foo) 
		   -- output: [Class: Foo]
		 fobj = new(Foo) -- creates a new object of type foo
		 print(fobj) -- print out our class object
		   -- output: [Object: Foo 3]
		 
		 -- overfloating printing function now
		 function Foo:toString()
		   return "Foo object printout!"
		 end
		 print(fobj) -- will print "Foo object printout!"
		 
		 -- creating a class that is derived from Foo
		 class "Test" : extends "Foo"
		 tobj = new(Test)
		 print(tobj) -- will also print "Foo object printout!",
		   -- because the toString function is derived from "Foo"
		
		!!Constructors
		
		The constructors have the same name as the class has.
		The default constructor will delegate its call to the 
		parent's constructor, however not so if the constructor
		is overloaded.
		
		Calling the parent constructor is being done by calling
		its classname like a method. 
		
		 class "Foo"
		 function Foo:Foo (v1,v2)
		   print("Foo constructor",v1,v2)
		 end
		 
		 class "Bar" : extends "Foo"
		 new(Bar,1,2)  -- will delegate the constructor call to 
		   -- Foo:Foo, passing the arguments 1,2 as v1 and v2,
		   -- resulting in a printout which looks like this:
		   -- Foo constructor 1 2
		
		Calling the constructors is done by calling the parent's 
		method. This can be problematic in some situations, but 
		these are not real world examples (i.e. if the object has a 
		variable with a name of a parent's class). Such situations
		can also be avoided either by not using capital letters 
		for object variables while saving them for class names 
		(which is similiar to Java's naming convention).
		
		 class "Foo"
		 function Foo:Foo ()
		   Foo:Object () -- call the constructor of Object
		     -- as every object is derived from this class
		 end
		 
		!!Compatibility
		 
		The function 'new', which acts as a constructor is
		compatible with older code - if a table that is passed as class 
		has a field named 'new', it will accept it as argument 
		and will call this function with the passed table as first argument
		and returns its return.
		
		This allows us to use the 'new' constructor also for 
		GUI code:
		
		 btn = new(Button,10,30,20,100,"Button")
		
		!!Default parent class: Object
		
		The default parent class is the Object class, a class
		that implements some basic operations.
		
		The classes are also derived from the Object type - extending
		the Object class with additional functions (which is always possible)
		will also result in changing the class objects. 
		
		!!Variables
		
		Any variable (functions are variables) can be defined any time.
		If a request on an object for a variable is made, it will return 
		its variable value or will look in the class (or parent class and so on)
		if the variable is defined there. Accessing nil values is the worst case,
		since the whole class tree is looked up. Avoid nil value access by setting 
		a variable value to false, if it is looked up more than once and turns out 
		to be a performance bottleneck.
		
		Example:
		
		 class "Foo"
		 obj = new (Foo)
		 
		 print(obj.x) -- prints nothing or nil
		 Foo.x = 10
		 print(obj.x) -- prints 10
		 obj.x = "bar"
		 print(obj.bar) -- prints "bar"
		 obj.x = nil 
		 print(obj.x) -- prints 10
		 Foo.x = nil
		 print(obj.x) -- prints nothing again
		
		Variables in classes can be used as default values, as 
		any object that has no such variable defined will automaticly
		return the value of the class' variable. Variables are 
		inherited to all its child classes, also to objects that 
		have been defined earlier.
		
		!!Overloading
		
		When a class is extended by another class, it can always redefine 
		a function, i.e.
		
		 class "Foo"
		 function Foo:dosomething () print "do something foo" end
		 
		 class "Bar" : extends "Foo"
		 function Bar:dosomehting() print "do something bar" end
		
		We can also overload or redefine functions when objects have already 
		been created. All objects will call automaticly the new function code.
		
		However, objects can also overload functions or variables:
		
		 class "Foo"
		 function Foo:dosomething () print "do something foo" end
		 
		 o = new (Foo)
		 function o:dosomething() print "Object code" end
		 print(o:dosomething) -- prints out "Object code"
		
		!!Spaces
		
		Classes can be defined inside other tables:
		
		 somewhere = {}
		 class ("Foo",somewhere)
		 obj = new (somewhere.Foo)
		 
		 class ("Bar",somewhere) : extends (somewhere.Foo)
		
		The default space is _G, which is why every class is 
		automaticly available in the global table.
		
@@

%class%
				(table) : (name,space = _G) - 
				creates a clase in the given space (default _G) and 
				returns a table, which contains a function named
				"extends", which accepts a class to be extended, i.e.
				
				 class "Foo" : extends "Object"
				
				per default, every class is derived from Object.
			
--------
%classparent%
				([class parent]) : (class) - returns the parent 
				of the class or none if it is the Object class.
			
--------
%new%
				(object) : (class,...) - creates an object and calls
				class[classname](obj,...)
			
--------

--------
{:Object}
	Parent class of all OO classes. The object oriented system
	is an implementation for an object oriented like programming
	in lua. The Object class provides some basic functionality.
	
@@

%getParentClass%
			([class]):(object) - returns the parent class, if it exists (Object 
			does not have a parent class, any other class does).
		
--------
%getTypeName%
			(string):(object) - returns name of the class
		
--------
%getClass%
			(class):(object) - returns class object
		
--------
%id%
			int id - a counter that is incremented by 1 whenever an object is 
			created
		
--------
%toString%
			(string):(object) - returns a string code for the given
			object, you can overload this in order to provide your 
			own identification of objects.
		
--------

--------
{:Timer}
Luxinia does automaticly call a function named 'think' in a table called 'luxinia'
		each frame. The Timer class registers this function and provides a mechanism
		to add additional function that should be called each frame.

		The function is being disabled if it throws an error.

		The timer has been changed during 0.93 to use coroutines. This is quite useful:
		you can yield a function at any point of time during execution if it is
		called by a timer or timertask. The execution is then continued later.
		For timers, this is the next period, for TimerTasks, please read the documentation
		on the TimerTask class. You can create endless loops just as this:

		 Timer.set("endless loop",
		 	function ()
		 		while true do
		 			print "tick"
		 			coroutine.yield()
		 		end
		 	end, 50)

		The code sample above will create a timertask that is executed about every
		50 ms and will always print "tick" out.

		Coroutines are useful utilities to create AIs, agents or gameloops.
		You do not have to change a state of a game function for example:

		 Timer.set("game",
		 	function ()
		 		local gamestarts,gamefinished
		 		repeat
		 			-- do something about intro menu etc. stuff
		 			coroutine.yield()
		 		until gamestarts

		 		repeat
		 			-- make some gamelogic stuff, spawing actors, etc
		 			-- set gamefinished to true or break loop if game is finished
		 			coroutine.yield()
		 		until gamefinished
		 	end, 1000/30)

		The code sample above will be executed every 30 fps. You can also nest the
		loops in loops, for example for each level. Instead of writing different
		functions that represent your state of game and that are selected for
		execution, you can use this method to create a linear way of writing a
		game.
		
@@

%remove%
():(string/function key) - removes a timer function from the Timer list.
--------
%think%
				():() - Function that is called each frame. If you switch to
				manual frame processing within lua, you should call this
				function each frame you do, since other modules are dependent
				on the timer function (i.e. the Keyboard class).
			
--------
%set%
(function fn):(string description,function fn[, int interval], [int maxcnt]) -
				set a function to be called each frame if interval is not passed.
				If interval is a number (minimum 1), the function will be called
				in the intervals in milliseconds. The timer automaticly repeates
				calls if the timer is late. If the maxcnt argument is passed,
				the timer won't be called more often than maxcnt per frame -
				if a timer is behind time, this prevents the system too freeze
				if the timerfunction is taking longer than its given interval.

				fn will be called with the local time of the function as first
				argument and the number of the repeated calls within
				this frame as second argument (@@fn(int localtime, int repeatedcalls)@@).
				The localtime is increased by the value of interval each time
				a call is done.

				Returns the passed function.
--------
%enable%
				():(string/function key) - enables a disabled timerfunction again
			
--------
%frame%
(int):() - returns the frame (or the number of thinkcycles)
--------
%finally%
				():(key,function) - the finally function is a list of
				functions that should be executed when all timers are finished.
				The timer and the finish functions are called in no particular
				order so this is just a method to do some stuff at the end
				of the timer calls (the timertasks are finished till then too).
				A key can
				only be registered one time, after that it will overwrite the
				previous function.

				The finally function registrations are only valid for the
				current frame, so you must reregister it if required.

				This functionality exists to provide help on optimized updating
				- you may want to collect information on for the real update
				function of an object that can then update all information
				alltogether instead of doing the same again and again updating
				ony tiny changes.

				Registering finally functions in a finally function call works.
				The new registered function is called once all previously
				registered functions have been executed.
				If you keep on registering finally functions, this means that
				the finally calls will never stop!
			
--------

--------
{:TimerTask}
A TimerTask is a function that is executed at a certain point of time.
		When you create a new task, you specify a time in the future at which
		the function should be executed. This class also offers a very simple
		system of scheduling for a little loadbalancing.

		TimerTasks are useful when you want to execute certain actions over
		a timer of at a point of time. For example, when an enemy is killed, you
		can create a timertask function that will remove the enmey after some time -
		or you can check then if a certain condition is set and react on that.

		!Samples:

		 TimerTask.new(function () print "time over" end, 1000)
		  -- prints "time over" in about a second


		 TimerTask.new(function () print "next frame" end)
		  -- prints "next frame" in the next frame


		 TimerTask.new(
		 	function ()
		 		print "from now on 30 secs"
		 		coroutine.yield(15000)
		 		print "... 15 seconds"
		 		coroutine.yield(5000)
		 		for i=10,1,-1 do
		 			print (i)
		 			coroutine.yield(1000)
		 		end
		 		print "bang"
		 	end,1
		 ) -- a countdown that starts in a millisecond


		
@@

%isValid%
(boolean):() - returns true if the task is still scheduled in the future
--------
%deleteAll%
():() - deletes all Tasks that are scheduled.
--------
%reenable%
():() - reenable the task. This is senseless once the date lies in the
		past.
--------
%pauseAll%
():(boolean pause) - Pauses the TimerTask scheduler. When scheduling is paused, no functions will be executed. If pause is is false, the scheduling is continued at the point when the system was paused.
--------
%tick%
():() - called from the timer each frame.
--------
%when%
(int time):() - Returns absolute moment of time when the function is called.
--------
%new%
([TimerTask]):(function f, [int time, [int variance, [int weight,
		[boolean absolute] ] ] ]) - Creates a new Task and returns it if the
		task is scheduled. The time is measured in milliseconds.

		The function will be called when the current time is larger or same as
		the time that was used for scheduling, which is as close as possible.
		Be aware that a single frame may use 3-5 ms, so multiple tasks with
		different schedule times may be called within the same frame!

		If no time is passed, the function will be called on the beginning of
		the next frame.

		You can specify a variance in which the function should be called.
		The function is then scheduled between time
		and time+variance. You can specify a weight of that task and the
		scheduling will try to place the task at a time where the totalweight
		is at a minimum. The algorithm is pretty primitive and no rescheduling
		is done here.

		If absolute is true, the moment of time is absolute, otherwise it is
		relative in the future.

		A taskobject will become garbage once its scheduling time lies in the
		past - it is like an entry in a "calendar" which becomes unimportant once
		the date passed.

		Once a task is scheduled, you cannot change the point of time when
		it will be executed.

		Note: The timertasks create coroutines that are then executed. You can
		yield a function that is called as timertask at any time, which means that
		the execution is continued later. If you pass no argument to the
		yield call (see coroutine.yield), the execution at this point is continued
		at the next frame. If you pass a number, the execution is continued
		at this point of time in the future.
		
--------
%getTaskTime%
		(int time):() - The TimerTask scheduling is using a own time (which can
		be paused). The returned time is the number of milliseconds that have
		passed since luxinia started minus the time when the scheduling was
		started. If you pass an absolute time, you have to calculate the
		time with this time.
--------
%disable%
():() - disables a task. It won't be executed anymore.
--------

--------
{:UtilFunctions}
The UtilFunctions class is a collection of usefull functions for lua.
@@

%luafilename%
	(string filename):(int level) - retrieves the filename of a luafunction,
	if possible.
	The level is the functioncallerstack and should be >=1
	returns filename and level of the found path.
	
--------
%luaDoFile%
original lua dofile function
--------
%loadFontFile%
(fontset,texture):(string fontname) - loads a font generated by the Font Bitmap Generator. The fontname must not contain
	a suffix (.lua). The function trys to load a fontfile that must reside in a 'fonts' directory. You must not delete
	the fontset yourself. All characters in the fontset that are not set by the font itself are mapped to the glyphid 0 (lefttopmost glyph)
--------
%getModelColMesh%
(tableBase,tableHit,[tableRaw]):(model,[boolean needrawtable],[matrix16],[boolean visibleonly],[boolean neednotrimeshdata]) - Creates a geom trimeshdata from the given model. Optionally transforms vertices.<br>
	tableBase : {data = dgeomtrimeshdata, aabox = {min{x,y,z},max{x,y,z}, center = {x,y,z}} <br>
	tableHit : {table similar to base, but for every "hitmesh" = meshes that contain "hitzone" in the material name <br>
	tableRaw : { inds = indices{}, verts = vertices{}, tris = tridata{{mesh=meshid,orig=original index}...} }, table with all indices/vertices and a table with the tridata for every face in the model
	
--------
%pairsByKeys%
	(function):(table,[comperator]) - returns an iterator function to traverse the table in
	sorted order. The comperator function can be used to use another ordering for traversion.
	The returned function returns three values if it is called: the key, the value, a
	number that tells the current index and another number that tells how many indeces
	are left to be be iterated. The comperator should take care about both
	values it gets - these could either be numbers, functions, strings, tables, etc.

	!!!!Example:

	 for key,value in UtilFunctions.pairsByKeys({cde=1, abc=2})
	 	do print(key,value) end

	!!!!Output:

	 abc  2
	 cde  3

--------
%setTableValue%
	([index,oldvalue]):(table,value,[newvalue]) - searches a val in the given table.
	The first hit is replaced by newvalue, which removes the tableentry if
	it is nil. You can use it therefore to remove a value from a table.
	The index of the removed element and the value is then returned.

	If no match was found, nothing is returned.

--------
%loadfile%
():(string path,...) - similiar to original loadfile except that this
	function trys to find the file in different locations relative to all
	loaded luafiles. This function replaces the original loadfile function.
--------
%luafilepath%
(string filepath):(int level) - like luafilename,
	but removes the filename itself
--------
%loadCollisionDataFile%
	(dgeom table,[extratable]):([string path,table],[boolean needoriginaltable],[boolean createl3ds]) - loads dgeoms from the collision data lua file. extratable can contain the tables: "original" and/or "visual".Currently exported by 3dsmax.
	
--------
%smallLogoPos%
	():(int n) - Sets the position of the small Luxinia Logo at one of the four
	corners (whatever you like more). Topright = 1, rightbottom = 2, bottomleft = 3,
	topleft = 4.

--------
%serialize%
	(string serialized):(table input) - Serializes a given table into a string that allows
	the reconstruction of the given table. It returns a string that describes the table's content
	with lua code. To deserialize the string, it must only be executed:
	
	 mytable = {1,2,3}
	 serial = UtilFunctions.serialize(mytable)
	 
	 mytable = nil
	 reconstructed = loadstring(serial)()
	 
	 for i,v in ipairs(reconstructed) do print(v) end
	  -- prints out 1,2,3 - converted first to string and then 
	  -- to a table again successfully
	
	The table may contain self cycles:
	
	 mytable = {1,2,3}
	 mytable.self = mytable
	 mytable[mytable] = "self index"
	 serial = UtilFunctions.serialize(mytable)
	 
	 mytable = nil
	 reconstructed = loadstring(serial)()
	 
	 print(reconstructed[reconstructed])
	 for i,v in ipairs(reconstructed.self) do print(v) end
	   -- prints out "self index" \n 1,2,3
	
	If the table contains function, the serilizing function will try to compile the 
	function in its binary representation using string.dump - which may fail if the 
	function is using local values from outside. 
	
	If the table has a metatable function entry named __serialize, this function 
	is being called and the return value is further serialized if it is a table value.
	However, if the function returns a string, the string is directly written 
	in the place where the serialisation takes place! You can inject lua code this way:
	
	 mytable = {}
	 setmetatable(mytable, {__serialize = 
	   function (self, idx)
	     return "function () return true end"
	   end
	 end
	 })
	 
	 print (UtilFunctions.serialize({ mytable }))
	 
	Output result:
	
	 local refs = {}
	 local fns = {}
	 for i=1,1 do refs[i] = {} end
	 		
	 refs[1][1] = function () return true end
	 
	 return refs[1]
	
	Important: don't serialize tables with __serialize metatables directly!
	Include them in a table instead, like in the example above.
	
	The serialisation function receives two arguments: the own table as 
	argument 1 and an index value as argument 2. The indexvalue represents 
	the id where the table data is stored (the refs table includes all 
	required values and other values must reference them as well, building 
	the cyclic tables and so on). The serialize function can return a 
	second value which tells the serializer how many reference table you 
	require - i.e. if you return 1 as second argument, an additional table
	is stored in refs. 
	
	You could also return a table, which is then serialized too, or a 
	string of a serialisation included in a function that is executed:
	
	 (function () UtilFunctions.serialize({1,2,3}) end)() 
	  -- creates a table {1,2,3}
	
	Since you can modify the output result, you can write inject any code you 
	want to save, meaning loops, functions and so on.
	
	The way the serialisation is stored is given in the output result above:
	A list of tables stored in refs is used to fill the data of the tables 
	one after another without breaking the consistence due to cyclic references.
	The fns table contains functions that are created with the string.dump functions.
	The loop creates all required tables so we can easily use them later.
	After this initialisation, the tables in refs are filled with all values. 
	At last, the first table value (which was passed to the serialize function) 
	is returned. You can either write this string in a file or make a lua 
	function of it by prepending "function serializedstuff () " and adding 
	"end" to the string returned by the serializing function.
	

--------
%color3hsv%
(float r,g,b):(float h,s,v) - converts the incoming hsv to color to 0-1 rgb floats
--------
%color3rgb2hsv%
(float h,s,v) : (float r,g,b) - converts the rgb color to a hsv color value
--------
%printf%
	():(string format, ...) - prints out a formated  string as the rules of string.format describe. This
	function is also stored in the global variable named printf

--------
%color3byte%
(float r,g,b):(float r,g,b) - converts the incoming color values 0-255, to 0-1 floats
--------
%fileexists%
	(boolean exists):(string path) - tries out if the given file exists.
	This is not very clean since it only trys to open and close the file and
	if it doesn't throw an error it is assumed that the file exists.
	
--------
%simplerenderqueue%
(l3dview):([l3dview]) - sets up a standard renderqueue for the view (which is also returned).
	The l3dview has equivalent rcmds in its table. The order is: rClear,rDrawbg,rLayers[1..16].
	Each rLayer contains: stencil,drawlayer,drawprt for the equivalent l3dlayerids-1. Sorting is enabled and material-based.
	
--------
%luaLoadFile%
original lua loadfile function
--------
%removeWindowResizeListener%
():(function) - removes the given function from being called on window resize events
--------
%freelook%
(boolean):(boolean) - enables/disables freelook of current default l3dcamera. Useful for debugging, FreeLook.invert .movemulti .shiftmulti let you modify behavior. Controls are WASD,C,SPACE + Mouse.
--------
%dofile%
():(string path,...) - similiar to original dofile except that this
	function trys to find the file in different locations relative to all
	loaded luafiles. This function replaces the original dofile function.
--------
%tabletotalcount%
	(n):(table) - returns the number of elements in that table and all of its childs
	it also traverses into the metatables, but ignores tables that are weak typed. It also counts metatables as element.

	This function should help to find memory leaks, which can occure if table references
	are not removed.

--------
%picktest%
([geom,{x,y,z},{nx,ny,nz}]):(dspace space,[x=mousex],[y=mousey],[maxlength=1000000],[l3dcamera camera = l3dcamera.default]) -
	This function will test the given space with a ray and returns, if a hit was generated, the geom, the coordinate of the
	nearest hit and the hitnormal. The ray is in line with the x,y pair (or the mouse coordinates if not given)
	on the camera projection plane and through the last known camera worldposition (this worldposition can be one frame behind, so
	you might have to call camera:forceupdate() to update to the currently set position if this is important, which is not in most cases).
	The maxlength can be optionally set and is per default set to 1000000. If no camera is specified, the default camera is used.

	This function handles also orthogonal camera fovs, which requires a different 
	raysetting code.

	!!Example:

	[img utilfunctions.picktest.png]

	 UtilFunctions.simplerenderqueue()

	 input.showmouse(true) -- so we can see the mouse
	 space = dspacehash.new() -- our space with our objects
	 box = actornode.new("box")  -- our box location
	 box.geom = dgeombox.new(1,1,1,space) -- the geom, placed in 0,0,0
	 box.geom.l3d = l3dprimitive.newbox("box",1,1,1) -- the l3d for our box
	 box.geom.l3d:linkinterface(box) -- link it
	 cam = actornode.new("cam",5,4,3) -- our cameranode so we can view
	 l3dcamera.default():linkinterface(cam) -- link it with defaultcamera
	 cam:lookat(0,0,0,0,0,1) -- and look at 0,0,0 (the box location)

	 highlight = actornode.new("highlight") -- a simple highlighter
	 highlight.l3d = l3dprimitive.newsphere("hightlight",0.05)
	 highlight.l3d:color(1,0,0,1) -- make sphere red
	 highlight.l3d:linkinterface(highlight) -- link it

	 local function test () -- our testing function
	 	 local g,pos = UtilFunctions.picktest(space)  -- test it
	 	 highlight.l3d:rfNodraw(not pos) -- don't highlight if no hit

	 	 if pos then  -- if we have a hit
	     highlight:pos(pos[1],pos[2],pos[3]) -- move the highlighter
	     g.l3d:color(1,math.sin(os.clock()*5)/2+.5,1,1)
	     	-- ^^ make the hit object do something
	 	 end
	 end

	 Timer.set("picker", test,20) -- run the test every 20ms
	
--------
%addWindowResizeListener%
():(function) - will call function after window was resized (directly after window.update or with a few milliseconds delay if thru window.resizemode > 0.
--------
%color4byte%
(float r,g,b,a):(float r,g,b,a) - converts the incoming color values 0-255, to 0-1 floats
--------

--------
{:Viewer}
The Viewer is a builtin model/animation/particle and material viewer
	of Luxinia. 
@@

%reloadMain%
():() - reloads maindata and all dependent data
--------
%reloadMat%
():() - reloads materials and all dependent data
--------
%initbase%
():() - sets up all data needed for the viewer, call this first
--------
%loadres%
():(string resname, [string animname]) - loads a given resource (.mtl,.f3d/.mm,.prt) and for models an animation (.ma) can be specified.
--------
%reloadAnim%
():() - reloads animations
--------

--------
{:tls}
TLS stands for 'threaded lua state' and is
	part of the luacore inside luxinia, which is the reason why
	it is not documented in the common way.

	Luxinia is running in a single thread, and only
	the main thread has the functionality to access
	the core library. It is not possible for a thread
	to execute any function of the core directly.

	If a new threading state is created, luxinia creates
	two new states, where one is running as a complete new
	thread, including all the default libraries that are
	included in lua, however without any additional functionality.

	A threaded state can reload DLLs at any point and thus can
	access most other functions that are provided by the external lua libs.

	This is for example the filesystem, the xml parser, and all networking
	functionality and so on.

	One of the created luastates acts as a communicator between
	the main thread and the slave thread, which is running
	in the second luastate. The communicator or exchange state
	is always used exclusivly, which means that if the main thread
	or the slave thread is accessing it, any other access is being
	blocked. The exchange state is loaded without library functions
	and thus cannot execute much code, however, it is possible to
	execute code within that state, which can is injected as a
	string and can come from one of both threads. The
	results of the execution is then returned to the executing thread.

	The current implementation is limited to the exchange of
	numbers and strings at the moment.

	It is important that the mainthread keeps a reference to the
	thread, otherwise the thread is stopped when the garbage collector
	destroys the thread.

	The package paths are automaticly copied from the main thread.

	!!Example:

	This example creates a new state and let it execute
	a loop, sleeping half a second and printing out the clock's time,
	until it is stopped by setting the requested variable value to nil:


	 state = tls.new()
	 state:xset("run",1)
	 state:start(
	 "	while xget 'run' do "..
	 "		sleep(.5) print(os.clock()) "..
	 "	end "..
	 "	print 'finished'")
	 TimerTask.new(function () state:xset("run",nil) end,2000)
	
@@

%xlock%
	():(tls) - locks the exchange state until it is unlocked. The
	other thread cannot access the exchange thread then. Use the
	lock when you need to make some atomic changes to the exchange
	state.

--------
%xunlock%
	():(tls) - unlocks the exchange state

--------
%running%
	(boolean isrunning):(tls) - returns true if the thread is still running

--------
%stop%
	():(tls) - destroys the thread, but waits until the mutex was
	unlocked. Don't use this function unless really required, as
	it might damage the luastate which can lead to a crash once
	it is reused.

--------
%xget%
	(boolean value / [nil, typename]):(tls, key) - returns a
	value for the key from the global environment table of the exchangestate

--------
%start%
	([boolean success],[string errormsg]):(tls,string code) -
	Starts the thread, running the given code. Once the execution
	is finished, the thread will terminate normaly. It can
	then be restarted, the states are not modified in that case.

	If an error occures, the function returns nil plus the error message.

	It is not possible to start the tls if it is still running.

	The started thread has a few global functions available, that allows
	it to control its execution:

	* (return_values) xdostring (string code) - executes a piece of code within the exchange state
	* ([nil,errormsg]) xset (key,value) - sets a key/value pair in the exchange state
	* (value / [nil,type]) xget (key) - returns a value for the given key in the exchange state
	* () xlock () - locks the mutex of the exchange thread, pausing any access on the exchange state
	* () xunlock () - unlocks the mutex of the exchange thread
	* () sleep (seconds) - sleeps for the given amount of time
	* () killme () - destroys the thread, effectivly kills the execution instantly




--------
%xset%
	([nil, error]):(tls, key,value) - sets a
	value for the key in the global environment table of the exchangestate

--------
%xdostring%
	([true,... / nil, error]):(string code) - executes a piece of
	code in the exchange thread, returning true in case of success and
	the returned values of the code or nil and the error message

--------
%new%
	(tls):() - creates a new threaded lua state object.

--------

--------

--------
::gui::
	The GUI module handles all kinds of graphical user interface representations
	and actions.

	If you want to write your own GUI classes based on the Component class,
	you need to call the supermethods of the classes. I.e. if you overload
	the mousePressed method of the button, you need to call the mousePressed
	method of the button within you method:

	 function MyButtonClass:mousePressed(event)
	   Button.mousePressed(self,event)
	   -- do your stuff here now
	 end

	If you forget to do this, your class will not work as expected.
	Super-constructors should be called too, ie

	 function MyButtonClass.new (class, x,y,w,h, ...)
	   local self = Button.new(class, x,y,w,h)
	   -- do your stuff now
	 end
	
--------
{:ButtonGroup}
A ButtonGroup is a list of Buttons that are informed when another button 
	was pressed. A ButtonGroup has only one active button per time. The 
	ButtonGroup is assigning ActionListeners to the buttons to receive calls 
	on clickactions. 
@@

%remove%
():(button) - removes the button from the buttongroup
--------
%onClicked%
():([theclickedbutton],[previousbutton]) - function that is called when
	a clickevent occured. This method does nothing and can be overloaded without 
	consequence.
--------
%addButton%
(Button):(Button, fnOnPush, fnOnRelease, boolean toggle) - adds a button to the list. 
	If this button is pushed or released (because another button was pressed),
	the corresponding functions are being called. The signature of the functions
	is: 
	 function react ([theclickedbutton], [previousbutton])
	You can use this functions to react on changes in the Buttongroup. Note that
	if the currently active button is pressed again, no event is generated here.
	
	If toggle is true, clicking the active element will deselect the group.
	
	This function makes the given button automaticly pushable.
	 button:setPushable(true)
	
--------
%new%
(ButtonGroup):() - creates a new Buttongroup
--------
%delete%
():() - deltes the group removing all the actionlisteners and so on
--------
%click%
():(button) - called by the actionlisteners. Calls automaticly the 
	assigned functiosn from the addButton function. Does nothing if the 
	button is currently marked as active (and is pushed). Calling the click 
	function with nil will deselect any button (except if you added the button as toggleable).
--------

--------
{:Component}
A Component is a 2D object on the screen that allows interaction with
	the mouse and keyboard of the user.

	All coordinates are always relative to the parent's Component.

	All components will propagate mouseevents to its parents! If the mouse is
	moved on a child, the parent that cannot "see" the mouse will receive
	events, too. This change was done in 0.93a. The reason is, that it is easier
	for the parent components to trace the mouse actions (i.e. mousewheel)
	in an easy manner. Most mouse actions are now receiving a second argument
	that tells, if the component is the owner of the mouse, which means that it
	is the topmost component at the mouse cursor's position.
	
@@

%onDisplayChange%
():(Component self, boolean isDisplayed) - called whenever the
	displaystate is changed, i.e. if the component was made invisible,
	or it's parent was removed from the rootpane etc.

	A component that is displayed has not to be visible.
--------
%local2world%
(int worldx,worldy):(int localx,localy) - returns world coordinates
--------
%index%
{[int]} - index id of the component
--------
%mouseEntered%
():(Component self, MouseEvent e, boolean mouseover) -
	called if the mouse is entered the Component
--------
%transferFocusOnArrows%
(boolean):(Component) - returns true if the component transfers the
	focus if an arrow is pressed is pressed
--------
%mouseClicked%
():(Component self, MouseEvent e, boolean mouseover) -
	called if the mouse was clicked on the component.
--------
%onVisibilityChange%
():(Component self, boolean isVisible) - called whenever
	the component is made visible / invisible.
--------
%setClip%
():([Component],boolean on) - Disables/Enables the clipping of the component(s).
	If no Component is passed, this is used as a GLOBAL parameter, not per component.
	It will affect only components that are going to be created.
	Clipping is done using the scissortest of OpenGL.
	These areas however can only be rectangular and may produce unwanted sideeffects
	if you use a different window.refsize than the screen resolution or if
	you want to rotate the components (which is possible but yet supported).
	Setting the clip to nil for a component will make it use the global parameter
	value. Currently, this parameter is only working correctly if disabled globally. 
--------
%isVisible%
(boolean):(Component self) - returns true if the component
	is displayable and visible, otherwise false
--------
%setLocation%
():(Component self, float x,y) - sets location of the Component
--------
%isFocusable%
(boolean):(Component) - returns true if the component can be focused.
	If you overload this method, please remember that you should return false
	if your element is current not focusable, ie. if not visible or not enabled.

	For example:
	 function TextField.isFocusable()
	   return true and self:isVisible()
	 end
	
--------
%getTooltip%
([string text / Component component]):(Component self) - returns the
	set tooltip information or nil if not present
--------
%hideVisibles%
():(Component self) - called when visible objects (l2ds) are no longer visible
--------
%toString%
(string):(Component self) - returns a simple string representation of this component
--------
%setTooltip%
():(Component self, [nil / string text / Component component]) - Sets tooltip
	information for this component, which is shown if the mouse holding its position.
	Passing nil will delete the tooltip information, setting a string will show the
	string as a simple textlabel, which is multilinecapable. If a component is
	passed, this component will be shown in the quickinfobox or whatever is
	showing the results. Setting the tooltip while it is shown will not affect the
	way it is displayed
--------
%getSkin%
([Skin2D]):(Component) - returns the skin used for this component
--------
%mouseExited%
():(Component self, MouseEvent e) -
	called if the mouse is exited the component
--------
%createVisibles%
():(Component self,l2dnode basel2d) - called when a Component is now displayable
	(doesn't have to be visible)
--------
%white%
[texture] - a 2x2 sized white texture for general purpose
--------
%getBounds%
(Rectangle rect):() - returns a copy of the current bounds, EVEN
	if the component hasn't been validated yet.
--------
%deleteVisibles%
():(Component self) - called when a Component is no longer displayed
--------
%skinnames.focusedskin%
{[string]} = component_focus - default skin-string for focused cases
--------
%mouseWheeled%
():(Component self, MouseEvent e, boolean mouseover) -
	called if the mousewheel was moved on the component
--------
%fadeTo%
():(Component self, table skincolor,table labelcololor, table iconcolor, speed,delay,onfinish,oncancel) -

	
--------
%hasFocus%
(boolean):(Component) - returns true if the element is focused
--------
%transferFocus%
():(Component self, int direction) - call this to transfer the focus in a direction
	relative to the component (forward/backward
--------
%focus%
():(Component self) - registers an element as
	the new focusowner.
--------
%setBounds%
():(Component self, float x,y,w,h) - sets bounds of the Component. Changes
	will be done when validate is called, which is done every frame once for
	all (drawn) components.
--------
%focuscolors%
[table] - array containing all defaultcolors on focus
--------
%getSize%
(float w,h):(Component self) - gets size of the Component
--------
%delete%
():(Component self) - deletes the component. Removes the component from
	any parent object and calls Component.onDestroy, that is also called when
	the Component is garbagecollected. Never overload delete, use onDestroy for custom actions instead.
--------
%zorderoffset%
[int] - sortid offset for l2dnodes
--------
%keyEvent%
():([Component],KeyEvent) - called if a keyevent occurred and the component
	has the focus. If a tab was pressed and transferFocusOnTab returns true,
	the focus is transfered. If enter was pressed and a onAction function is
	present, onAction is called. Otherwise the components keylisteners are
	called. 
--------
%lockMouse%
():(Component) - locks the mouse to this component. As long as the
	mouse is locked, no other component will receive mouseevents. This
	does not affect MouseListeners that are attached to the MouseCursor.
--------
%onLostFocus%
():(Component,Component tocomponent) - event if the component lost the
	focus to tocomponent.
--------
%mouselisteners%
{[table]} - list of mouselisteners
--------
%world2local%
(int localx,localy):(int worldx,worldy) - returns local coordinates
--------
%getX%
(int):() - returns current local x origin
--------
%unlockMouse%
():(Component) - releases the mouselock,
	but only if the Component is also the locker of the mouse.
--------
%getMinSize%
(Rectangle):(Component self) - returns minimum size of component
--------
%skinnames.defaultskin%
{[string]} = component - default skin-string for default cases
--------
%removeKeyListener%
():(Component self, KeyListener kl) - removes kl from the list of keylisteners
--------
%remove%
():(Component self) - removes the Component from its parent
	object.
--------
%think%
():(Component self) - called each frame if the component is visible and
	inserted in the rootpane or one of its ancestors. Overload this method
	to perform your own operations here
--------
%removeTooltipListener%
():(Component self, function) - removes all functions that are equal
	to entries in the tooltiplistener list
--------
%setSize%
():(Component self, float w,h) - sets size of the Component
--------
%validateFocus%
():(Component self) - Called once a frame and build a list of focusable components
	
--------
%getParent%
(Container):() - returns parent container if exists
--------
%getHeight%
(int):() - returns current height
--------
%newFocusOrder%
(table old):(table new) -
	Sets a new focus order list as given in the passed table.
	It returns the old focuslist then and sets the current focuselement to nil.
	This method can be used to create modal dialogs, though you have to
	watch out to restore the list again, once the old elements should be
	accesible again. 
--------
%setSkin%
():(Component, [Skin2D,[boolean copy] ]) - sets a skin to be used for displaying this
	component. If no value is set, the skin is removed. Invalidates the
	Component.

	If then skin is a string named "default" a default skin is used.

	If copy is true, the skin's cloning function is called to create a copy of
	that skin.

	The Component class is using following skin surface mappings:
	* component - simple default surface
	* component_hover - highlighted surface if mouse is over the component
	* component_pressed - if the mouse is clicked on the component
	
--------
%addKeyListener%
():(Component self, KeyListener kl) - add a keylistener to the component
--------
%updateSkin%
():(Component self) - updates skin information 
--------
%new%
(Component):(table class, int x,y,w,h, [Skin2D skin]) -
	creates a component with the given bounds of type class.
	A Component may optionally be initialized with a Skin2D skin, a visual
	representation of the Component. 
--------
%acceptSkinBounds%
([accepts]):(Component,[accepts]) - sets or gets behaviour of sizing.
	A skin may have other preferred sizes than chosen by the component. In
	that case, the component may have different preferred sizes than expected.
	Per default, this value is true.

	If no skin is set, this value has no meaning
--------
%skinnames.hoveredskin%
{[string]} = component_hover - default skin-string for hovered cases
--------
%moveToRect%
():(Component self, x,y,w,h,speed,delay,onfinish,oncancel) -
	moves a component animated to a certain target. The given x,y, w,h are the target
	bounds. The speed must be a factor between 0 and 1, where 1 is the fastest while
	0 will never reach the target. The delay is the amount of milliseconds to be
	waited after each step (it is using a TimerTask to perform the animation).
	The onfinish function is the function to be called if the target is reached.

	If the animation is interupted by another animation call, the oncancel function
	will be called.
--------
%getClipRect%
(Rectangle):(Component) - returns clipping of the component. The function
	traverses to the root to find out the clipping region until the component
	has no parent any more.
--------
%isClipped%
(boolean):([Component]) - returns state of clipping, is the global or of the
	component
--------
%clipinsets%
[table] - top, right, bottom, left inset values, default = 0,0,0,0
--------
%onDestroy%
():(Component self) - called if the garbage collector collects the
	object or if the component was deleted. Overload this method for
	custom actions, i.e. deleting all l2dnodes etc.
--------
%getMouseLock%
(Component):() - returns the Component that is currently locking the mouse.
--------
%showVisibles%
():(Component self) - called when visible objects (l2ds) are now visible
--------
%setColor%
():(Component self, table skincolor,table labelcololor, table iconcolor, [mix a=0], [mix b=1]) -

	
--------
%setVisibility%
(boolean):(Component self) - returns true if the component is
	displayed (is actually on the rootpane) and is visible.
--------
%setFont%
():(Component,[string font]) - sets fontname to be used. Pass noting if
	you want to use the defaultfont again.
--------
%showTooltipInformation%
() : (Component self) - triggers displaying the tooltip information.
	It will look if the component has a function set named 
--------
%mouseEvent%
():(Component self, MouseEvent e) -
	called if a mouseevent occurred
	that is interesting to this component. It will informa all mouselisteners
	of the component of this action. 
--------
%setDisplayable%
():(Component self, boolean displayable) -
	a displayable component should create all it needs to be displayed
	(l2dnodes & stuff).
--------
%isMouseLocker%
(boolean):(Component) - returns true if the component is locking the mouse
--------
%getLocation%
(int x,y):() - returns current Location
--------
%mousePressed%
():(Component self, MouseEvent e, boolean mouseover) -
	called if the mouse was pressed on the component. If mouseover is true,
	the mouse is actually on THIS component and not on one of its childs,
	which will create events too.
--------
%validate%
([int z]):(Component self, [int z]) - validates the new position of the component.
	don't call this method during a mouseevent or strange things may happen.
	If the Component's bounds were changed, positionUpdate will be called.
	The z parameter is the z-sort order and the component should return an
	incremented z value, reserving the z-values it needs for its own
	(validation is down in z-sorted order). If no z is given, no reordering
	is done.
--------
%skinnames.pressedskin%
{[string]} = component_pressed - default skin-string for pressed cases
--------
%addMouseListener%
():(Component self, MouseListener ml) - add a mouselistener to the component
--------
%invalidate%
():(Component self) - marks component to be updated on next validation
--------
%positionUpdate%
(int newz):(Component self,int zindex,Rectangle clip) - called when the component was moved or resized.
	Overload this method for visual appearance. The zindex is the id to use for
	zordering the components. Return the newz value, reserving all the values that
	you require for your visual nodes.
--------
%getRight%
(int):() - returns x+width, which is the rightmostline of the component
--------
%getWidth%
(int):() - returns current width
--------
%getY%
(int):() - returns current local y origin
--------
%onGainedFocus%
():(Component,Component fromcomponent) - event if the component
	gained the focus from fromcomponent.
--------
%mouseMoved%
():(Component self, MouseEvent e, boolean mouseover) -
	called if the mouse actually moved over the Component. 
--------
%getFocusIndex%
():(Component self) - returns absolute index of the focusorder
--------
%getFocusElement%
([Component]):() - returns the current element of focus if available
--------
%addTooltipListener%
(function):(Component self, function) - adds a tooltiplistener. The
	function will receive a Tooltipevent as only argument when fired.
--------
%isDisplayedFlag%
{[boolean]} - true if the component is on the rootpane
--------
%getFocusComponentAt%
(Component):([Component], int direction) -
	returns focuselement. If Component is given, the direction is relative
	to the component, if not, the absolute focuselement is returned.
	Only elements that return true on isFocusable are counted. 
--------
%keylisteners%
{[table]} - list of keylisteners
--------
%transferFocusOnTab%
(boolean):(Component) - returns true if the component transfers the
	focus if tab is pressed
--------
%setDisabled%
():(Component,boolean yes) - disabled components won't generate mouse or keyevents.
	The Component's skin is set to half transparent, storing the previous alpha value and
	keeping the current rgb value.
	
--------
%colors%
[table] - array containing all defaultcolors
--------
%getBottom%
(int):() - returns y+height, which is the bottomline of the component
--------
%removeMouseListener%
():(Component self, MouseListener ml) - removes ml from the list of mouselisteners
--------
%contains%
(boolean):(Component self, float x,y) - checks if the given point is
	inside the component. Overload this method if you need more specific
	hittests than a rectangletest. Coordinates are relative.
--------
%isVisibleFlag%
{[boolean]} - true if the component is visible
--------
%mouseReleased%
():(Component self, MouseEvent e, boolean mouseover) -
	 called if the mouse was released on the component
--------

--------
{Component:Button}
A Button is a Component that reacts on mouseclicks and other mouseactions.

	Creating a simple button that reacts on mouseclicks is as easy as this:
	 btn = Button:new(10,10,80,30,"Hello") -- create button
	 function btn:onClicked()  -- function that is called on click events
	   print("Hello") -- do whatever you like
	 end
	   -- put the button now on the root container
	 Container.getRootContainer():add(btn)
	   -- otherwise it won't be visible
@@

%addActionListener%
():(function action,[string/any description]) -
	Adds a function that is called when the button is clicked. The
	description is optionial. The action function
	signature:
	 function actionfunction (buttonobject,datatable)
	the datatable contains at index 1 the function and at index 2
	the description. You can change the datatable in any way you want -
	however, the function at index 1 will be the function that is being
	called if an action occurs.
--------
%deleteVisibles%
():(Button self) - called when a Component is no longer displayed
--------
%setPushState%
():(Button,boolean) - pass true if the button should be pushed. Setting
	The pushstate won't affect actionlisteners and click functions.
--------
%positionUpdate%
():(Button self) - updates all the position info
--------
%dataButton%
{[table]} - the current state info of the button.
--------
%setText%
():() - sets text of button
--------
%dataButton.mouseover%
{[boolean]} - true if the mouse is over the button
--------
%mousePressed%
():(Button self, MouseEvent e) - called if the mouse was pressed on the button
--------
%setPushable%
():(Button, pushable, [state]) - Makes the button pushable. A pushbutton switches
	between the normal and pressed state. You can use a third optional parameter
	to set the state to an initial value.
--------
%isPushed%
(boolean):(Button) - returns true if the Button is pushed
--------
%setIcon%
():(texture/string icon, width,height,uvx,uvy,uvw,uvh, [blendmode]) -
	sets icon for the button. This is only a forwarder on the Skin2D.setIcon
	function and will throw an error if no skin is set for this button.
	The default blendmode is decal. If false is passed as blendmode, no
	blend is used.
--------
%dataButton.pressedMouseButton%
{[int]} - the mousebuttonid that holds the button down
--------
%setDisplayable%
():(Component self, boolean displayable)  - description from overloaded method of Component:

a displayable component should create all it needs to be displayed
	(l2dnodes & stuff).
--------
%mouseEntered%
():(Button self) - sets mouseinside to true
--------
%dataButton.pressed%
{[boolean]} - true if the button is hold down
--------
%new%
(Button):(table class, float x,y,w,h, string caption, [Skin2D skin]) -
	creates a new Button object.

	The Skin should have 8 states:
	* button
	* button_hover
	* button_pressed
	* button_hover_pressed
	* button_focus
	* button_focus_hover
	* button_focus_pressed
	* button_focus_hover_pressed

	If no skin is passed the default skin is cloned.
	
--------
%setVisibility%
(boolean):(Component self)  - description from overloaded method of Component:

returns true if the component is
	displayed (is actually on the rootpane) and is visible.
--------
%mouseMoved%
():(Button self, MouseEvent e) - called if the mouse actually moved over the button
--------
%mouseReleased%
():(Button self, MouseEvent e) - called if the mouse was released on the button
--------
%removeActionListener%
([function,description]):(function/any key) - removes the actionlistener from the
	object where the key can be the function or the description itself.
--------
%isFocusable%
(boolean):(Component)  - description from overloaded method of Component:

returns true if the component can be focused.
	If you overload this method, please remember that you should return false
	if your element is current not focusable, ie. if not visible or not enabled.

	For example:
	 function TextField.isFocusable()
	   return true and self:isVisible()
	 end
	
--------
%actionListeners%
{[table]} - a list of all actionlisteners
--------
%hideVisibles%
():(Button self) - called when visible objects (l2ds) are no longer visible
--------
%toString%
():(Button self) - returns simple string representation of the button
--------
%onAction%
():(Button self) - calls directly clicked (invoked by actioncommands such
	as ENTER on focused buttons
--------
%onClicked%
():(Button self, boolean state) - simple callback function that can be overloaded without
	calling the superclass etc. Is called after all ActionListeners has been
	processed. The state boolean flag is true if the button is currently pushed,
	which matters only for pushable buttons - otherwise it is always false.
--------
%dataButton.pressedSince%
{[int]} - if button is pressed, this value stores the frame when the
			mousebutton was pressed
--------
%setCustomL2d%
([l2dnode]):(Component self,[l2dnode, float x, y,z]) -
	set a custom l2dnode for own purpose. The previously set custom l2dnode is
	deleted. The new customl2dnode ist also deleted if the button is deleted.
	The new customl2dnode is returned by this function. If no l2dnode is given,
	the old customl2dnode is deleted.
--------
%mouseExited%
():(Button self) - sets mouseinside and mousedown to false
--------
%clicked%
():(Button self) - called if the button was actually clicked. Is called
	if the mouse is clicked, but can be called by other sources, too. Calls
	all actionlistener functions. This method calls the actionlisteners.
	Overload onClicked instead for simple use.
--------
%dataButton.isFocusable%
{[boolean=true]} - can gain focus if true
--------
%isPushButton%
(boolean):(Button) - returns true if the Button is a pushbutton
--------

--------
{Button:Checkbox}
A Checkbox component. Basicly it is a slightly modified Button and
	works in the same ways like the Button. The checkbox class is using the icon
	to display the checkbox next to the text.

	You can create and use a checkbox in this way:

	 ck = Checkbox:new(10,90,200,24,"Check me out!")
	 function ck:onClicked(state)
	   if (state) then print("I am checked")
	   else print("I am unchecked") end
	 end
	 Container.getRootContainer():add(ck)

	The following skinssurface names are used by the checkbox class:

	* checkedcheckbox_pressed
	* checkedcheckbox
	* checkedcheckbox_hovered
	* checkedcheckbox_hovered_pressed
	* checkedcheckbox_focused
	* checkedcheckbox_focused_hovered
	* checkedcheckbox_focused_pressed
	* checkedcheckbox_focused_hovered_pressed

	* checkbox_pressed
	* checkbox
	* checkbox_hovered
	* checkbox_hovered_pressed
	* checkbox_focused
	* checkbox_focused_hovered
	* checkbox_focused_pressed
	* checkbox_focused_hovered_pressed
	
@@

%skinnamesunchecked%
{[table]} - skinnames in case the element is not checked
--------
%skinnameschecked%
{[table]} - skinnames in case the element is checked
--------
%new%
(Checkbox):(class, float x,y,w,h, string caption, [Skin2D skin,Icon] ]) -
	Creates a checkbox at given location and with given size. The caption
	is automaticly set to be aligned left on the skin and vertically centered.
	It also activates the autowidth parameter of the skin and makes the
	button it was derived from pushable.
	
--------

--------
{Component:Container}
A container is a collection of Components.
@@

%onDisplayChange%
():(Container self, boolean isDisplayed) - called whenever the
	displaystate is changed, i.e. if the component was made invisible,
	or it's parent was removed from the rootpane etc.

	A component that is displayed has not to be visible.
--------
%mouseEvent%
():(Container self, MouseEvent event, boolean exit) - processes the mouseevent and
	delegates it to it's children and mouselisteners. If exit is true, the mouse is now
	on another component
--------
%isChildOf%
(boolean):(Container, parent) - returns true if a parent
	of the ancestors is equal to parent
--------
%invalidate%
():(Component self)  - description from overloaded method of Component:

marks component to be updated on next validation
--------
%onVisibilityChange%
():(Container self, boolean isVisible) - called whenever
	the container is made visible / invisible. Calls onVisibilityChange
	of all child components. 
--------
%new%
(Container):(table class, int x,y,w,h) - creates a container with the given bounds
--------
%delete%
():(Component self)  - description from overloaded method of Component:

deletes the component. Removes the component from
	any parent object and calls Component.onDestroy, that is also called when
	the Component is garbagecollected. Never overload delete, use onDestroy for custom actions instead.
--------
%getRootContainer%
(Container):() - returns the rootcontainer which is the main frame.
--------
%validate%
():(Container self) - validates the container and all its childs.
	Is called once per frame for containers that are visible,
	don't call it unless you really need it.
--------
%removeChilds%
():(Container) - removes all childs of the container
--------
%moveZ%
():(Container,Component a/ number index,toindex) - deletes all childs of the container
--------
%getComponentAt%
([Component]):(Container self, float x,y) - returns container at the
	specific position. Returns self if no child is found that matches and
	if the point is contained in the component.
--------
%deleteChilds%
():(Container) - deletes all childs of the container
--------
%removeComponent%
():(Container, Component) - removes the component from the container
--------
%toString%
():(Container self) - returns a simple string representation of self
--------
%isRootContainer%
(boolean):(Container) - returns true if the container is the rootcontainer
--------
%components%
{[table]} - list of components on the container
--------
%add%
(Component):(Container, Component,[int index]) - adds the component to the list of components.
	If Index is passed, it will be inserted at a certain z-position. The lower indexes are
	on the foreground, higher numbers are on the background. Returns the added Component
--------

--------
{Container:ComboBox}
A ComboBox combines multiple strings that can be selected in a
	small rectangle. The current state is very simple but is capable of mimic the
	basics of a normal ComboBox.
@@

%addItem%
(function add):(ComboBox, string caption, [string cmd,[icon, iconskinselection] ]) - 
	adds an item to the combobox. It returns a function that can be called again:
	 mycombobox:addItem("Hello")("World") -- adds hello and world 
--------
%onSelected%
():(ComboBox,int index, string caption, string command) - this function
	can be overloaded without calling this function. It is called each time the
	user selects an item - which does not have to be different from the previously
	selected item.
--------
%new%
(ComboBox):(table class, int x,y,w,h,[Skin2D skin]) - creates a combobox
	at the given coordinates with the given skin.
--------
%select%
(int selected):(ComboBox, string/int something, [boolean iscommand]) -
	selects the specified item by its name, number or commandstring
--------
%removeItem%
():(ComboBox, int id) - Removes an item from the list. The id refers to the 
	index of the item in the list.
--------
%getSelected%
([int index, string caption, string command]):(ComboBox) -
	returns information on the currently selected item.
--------
%clearItems%
():(ComboBox) - removes all items from the list
--------

--------
{Container:GroupFrame}
Groupframes are containers with an initial skin
@@

%new%
(GroupFrame):(table class, int x,y,w,h,[Skin2D skin]) - 
	creates a container with the given bounds. If no skin is given the 
	default skin for frames is being used.
--------

--------
{Container:ListBox}
A scrollable listbox.
@@

%itemCount%
(n):(table class) - returns the number of items in the list.
--------
%getSelected%
([int indx, string caption, command]):(ListBox) - returns the currently selected item
--------
%select%
(int selected):(ListBox, string/int something, [boolean iscommand]) -
	selects the specified item by its name, number or commandstring
--------
%find%
([index,caption,command]):(ListBox, id, string what) - returns index of element in list that matches the 
	search. If what is 'command', id is compared with the commands, if what is 'caption', the
	id is compared with the captions.
--------
%addItem%
():(ListBox, string caption, [string cmd,[icon, iconskinselection] ]) - 
--------
%onSelected%
():(ListBox,int index, string caption, string command) - this function
	can be overloaded without calling this function. It is called each time the
	user selects an item - which does not have to be different from the previously
	selected item.
--------
%new%
(ListBox):(table class, int x,y,w,h,[Skin2D skin]) - creates a listbox
	at the given coordinates with the given skin.
--------
%removeItem%
():(ListBox, int index, [string what]) - removes item at given index. If what is 'command' then the 
	index is searched of an item whichs command is equal to id, if what is 'caption' the id is compared 
	with the caption.
--------
%renameItem%
():(ListBox, int index, [caption],[command],[icon],[iconname]) - renames an item at the given index
--------
%clearItems%
():(ListBox) - deletes all items in the list 
--------

--------
{Container:TitleFrame}
TitleFrames are containers with an initial skin. Following skinnames are being used:

	* titleframe
	* titleframe_hover
	* ...
@@

%setTitleAlign%
(TitleFrame):(TitleFrame,align) - sets titlecaption alignment. Can be either
	Skin2D.ALIGN.LEFT, Skin2D.ALIGN.RIGHT or Skin2D.ALIGN.CENTERED or a number
	for the absolute x coordinate.
--------
%setTitle%
(TitleFrame):(TitleFrame,text) - sets titlecaption
--------
%new%
(TitleFrame):(table class, int x,y,w,h,[Skin2D skin],[string title]) -
	creates a container with the given bounds. If no skin is given the
	default skin for frames is being used.
--------

--------
{Component:ImageComponent}
A ImageComponent element for displaying simple images (textures, material, plain colors).
@@

%deleteVisibles%
():(Component self)  - description from overloaded method of Component:

called when a Component is no longer displayed
--------
%onGainedFocus%
():(from) - simply forwards the focus to the next element.
--------
%positionUpdate%
(int newz):(Component self,int zindex,Rectangle clip)  - description from overloaded method of Component:

called when the component was moved or resized.
	Overload this method for visual appearance. The zindex is the id to use for
	zordering the components. Return the newz value, reserving all the values that
	you require for your visual nodes.
--------
%color%
():(ImageComponent,float r,g,b,a) - color for imagecomponent
--------
%blendmode%
():(ImageComponent,blendmode) - blendmode for imagecomponent
--------
%getUVRotRad%
(phi):(ImageComponent) - gets uv rotation angle
--------
%mouseClicked%
():(Component self, MouseEvent e, boolean mouseover)  - description from overloaded method of Component:

called if the mouse was clicked on the component.
--------
%getL2DImage%
(l2dimage):(ImageComponent) - returns the used imagecomponent
--------
%new%
(ImageComponent):(class, int x,y,w,h, matsurface, [autofocus],[blendmode],[matrix16 texmatrix]) -.
--------
%setL2DImage%
():(ImageComponent,l2d) - sets the used l2dimage
--------
%getUVPos%
():(ImageComponent,x,y) - gets uv translation
--------
%isFocusable%
(boolean):(ImageComponent) - returns true if visible
--------
%toString%
(string):(ImageComponent) - returns simple component representation
--------
%texmatrix%
(matrix16):(ImageComponent,matrix16) - texturematrix for imagecomponent, pass a non matrix16 to disable
--------
%matsurface%
(matsurface):(ImageComponent,matsurface) - matsurface for imagecomponent
--------
%setUVScale%
():(ImageComponent,x,y) - sets scaling for uv
--------
%setUVRotRad%
():(ImageComponent,phi) - sets uv rotation angle
--------
%createVisibles%
():(Component self,l2dnode basel2d)  - description from overloaded method of Component:

called when a Component is now displayable
	(doesn't have to be visible)
--------
%setUVPos%
():(ImageComponent,x,y) - sets uv translation
--------
%getUVScale%
(x,y):(ImageComponent) - gets scaling for uv
--------

--------
{Component:Label}
A Label element for displaying only.
@@

%deleteVisibles%
():(Component self)  - description from overloaded method of Component:

called when a Component is no longer displayed
--------
%onGainedFocus%
():(from) - simply forwards the focus to the next element.
--------
%positionUpdate%
(int newz):(Component self,int zindex,Rectangle clip)  - description from overloaded method of Component:

called when the component was moved or resized.
	Overload this method for visual appearance. The zindex is the id to use for
	zordering the components. Return the newz value, reserving all the values that
	you require for your visual nodes.
--------
%setText%
():(Label,string) - sets the label's text
--------
%setFontColor%
():(r,g,b,a) - sets RGBA font color of the label
	
--------
%getText%
(string):(Label) - returns the string label
--------
%mouseClicked%
():(Component self, MouseEvent e, boolean mouseover)  - description from overloaded method of Component:

called if the mouse was clicked on the component.
--------
%new%
(Label):(class, int x,y,w,h, text, [align, [autofocus] ]) - creates a labelwith the
	given dimensions. The align value can be a constant from the Label
	table (Label_ALIGNRIGHT, ...).
--------
%LABEL_ALIGNLEFT%
[int] - constant for left text alignment
--------
%LABEL_ALIGNCENTERED%
[int] - constant for centered text alignment
--------
%isFocusable%
(boolean):(Label) - returns true if visible
--------
%setAlignment%
():(Label,[alignment],[vertical_align]) - sets textalignment, or resets to default (left aligned)
--------
%LABEL_ALIGNBOTTOM%
[int] - constant for vertical text alignment at bottom
--------
%toString%
(string):(Label) - returns simple component representation
--------
%LABEL_ALIGNRIGHT%
[int] - constant for right text alignment
--------
%wrapLine%
(string):(Label,string,[width]) - uses the current label's font and size to wrap the line by inserting \n
	characters. If a width is provided, the wrapping is done using this width
	
--------
%onTextChange%
():(Label) - called if the text changed (ie. by user input)
--------
%getMaxLines%
(lines):(Label,[height=getHeight]) - gets the maximum number of currently (or for height) visible lines
--------
%maxLineCount%
(float lines):([height]) - uses the current label's font and size to
	calculate how many lines can be displayed at the moment. The return
	value is floating point, as lines might not fit in completly.
	
--------
%createVisibles%
():(Component self,l2dnode basel2d)  - description from overloaded method of Component:

called when a Component is now displayable
	(doesn't have to be visible)
--------
%getAlignment%
(string alignment):(Label) - returns current alignment of the label's text
--------
%LABEL_ALIGNTOP%
[int] - constant for vertical text alignment at top
--------

--------
{Label:MultiLineLabel}
A MultiLineLabel element for displaying longer texts. A text can be marked
	with a special syntax (see function description at new) which allows
	creating texts with clickable zones, similiar to a hypertext
	document.
@@

%getPreferredSize%
(w,h):(MultiLineLabel) - returns the preferred size, which is the longest line in width and the sum of all lineheights in height
--------
%positionUpdate%
(int newz):(Component self,int zindex,Rectangle clip)  - description from overloaded method of Component:

called when the component was moved or resized.
	Overload this method for visual appearance. The zindex is the id to use for
	zordering the components. Return the newz value, reserving all the values that
	you require for your visual nodes.
--------
%onTextChange%
():(MultiLineLabel) - called if the text changed (ie. by user input)
--------
%new%
(MultiLineLabel):(class, int x,y,w,h, text, boolean highlights, align,fontsize) -
	creates a labelwith the
	given dimensions. The align value can be a constant from the MultiLineLabel
	table (MultiLineLabel_ALIGNRIGHT, ...). If highlights is true, the displayed
	text is scanned for a special syntax that creates clickable zones on the
	component. The bounds of the zones are fitted on the marked text passages.
	The markers are stripped away and are not displayed. A marker can be set by
	inserting $$link...$$ into the text, where the ... can be just any string. This
	string is then used as zonedescription. To end a zone, a $$link$$ can be set.
	
--------
%createVisibles%
():(Component self,l2dnode basel2d)  - description from overloaded method of Component:

called when a Component is now displayable
	(doesn't have to be visible)
--------
%setAlign%
():(MultiLineLabel,align) - Sets the alignment of the text
--------
%addClickZone%
():(self,x,y,w,h,description,l2d,strstart,strend) - Intern function that is used for adding
	a zone. A zone is an area on the multilinelabel that can receive mouseevents (i.e.
	for creating hyperlinks). This function is called when the multilinelabel is made visible and
	the l2d nodes for displaying are created. The last two values are telling the position of the
	linked textstring.
--------
%getColor%
(float r,g,b,a):(MultiLineLabel) - returns rgba for basecolor
--------
%testForZone%
([table zone]):(self,x,y) - tests if the coordinates (local) are inside a zone - the first hit
	is returned. The zone contains following value:
	* rect: Rectangle info of size and position of zone
	* description: linkstring info
	* l2d: the l2dtext node where the line is located
	* strstart: position where the linked string starts (including the link)
	* strend: position where the linked string ends (excluding the link)
--------
%countLines%
(lines):(MultiLineLabel, text) - returns number of lines for this text for the current dimension of the textfield
--------
%zoneAction%
():(self,string what,mouseevent,[zone]) - called on mouseevent action. The 'what' value is either
	"exit", "moved" or "clicked" and describe the type of action. The zone is the retrieved zone for that
	mouseposition. If no zone was matched it is nil.
--------
%setColor%
():(float r,g,b,[a]) - sets color for texts
--------

--------
{Component:Slider}
The slider is a handle than can be moved within some limits.

	You can create and use a slider in this way:

	 slider = Slider:new(100,20,100,20)
	 function slider:onValueChanged (newvalue,oldvalue)
	   print(newvalue,oldvalue)
	 end
	 Container.getRootContainer():add(slider)

	The following skinssurface names are used by the slider class:
	* Vertical slider skin surfaces
	** sliderv
	** sliderv_pressed
	** sliderv_hovered
	** sliderv_focused
	* Horizontal slider skin surfaces
	** sliderh
	** sliderh_pressed
	** sliderh_hovered
	** sliderh_focused

	
@@

%setIncrement%
(),(Slider, float inc) - Sets sliderincrement of slider. You could
	set the value directly by assigning a new value to the sliderincrement
	value, but you shouldn't chose values <=0 or >1 and you should update
	the sliderposition to its new value in case that the integermode is on
	and the value is hereby changed.
	
--------
%mouseWheeled%
():(Slider,MouseEvent) - This function sets the sliderposition if the
	mousewheel was turned.
--------
%sliderincrement%
{[float]}=0.1 - increment of sliderposition. Can be set per
			slider. The increment value is used if the mousewheel or the arrow keys have been used.
--------
%setIntegerMode%
(),(Slider, boolean on) - switches IntegerMode on and of. In integermode,
	the values that are set are being rounded to even multiplies of the
	sliderincrement value.
--------
%onValueChanged%
():(Slider, float newvalue,prevvalue) - called if the slider position was changed.
	The values are always between 0 and 1. You can overload this function without
	calling the original overloaded function. This function is only called if
	the previous value is distinct from the new value.
--------
%getSliderPos%
(float pos):(Slider) - get the position of the slider 0-1.
--------
%new%
(Slider):(class, int x,y,w,h, [boolean vertical, [Skin2D, [Icon] ] ]) -
	Creates Slider with given bounds. If vertical is true the slider
	is vertical aligned.
--------
%onKeyTyped%
():(Slider,KeyEvent) - Attached to Slider with a keylistener.
	Will react on arrow up/down/left/right keypresses and moves the slider.
--------
%setSliderTo%
():(Slider,x,y) - sets the slider position nearest to a pixelposition
	given by x and y that are in local coordinates of the component.
--------
%setSliderPos%
():(Slider, pos, noevent) - set the position of the slider, calls automaticly the
	onValueChanged method. The value is automaticly clamped to a value
	between 0 and 1. If noevent is true, no valuechanged event is sent
--------

--------
{Component:TextField}
A textfield element for usertextinput. Textfields have following skinsurfaces:
	* textfield
	* textfield_hover
	* textfield_focus
	* textfield_disabled
	
@@

%deleteVisibles%
():(Component self)  - description from overloaded method of Component:

called when a Component is no longer displayed
--------
%positionUpdate%
(int newz):(Component self,int zindex,Rectangle clip)  - description from overloaded method of Component:

called when the component was moved or resized.
	Overload this method for visual appearance. The zindex is the id to use for
	zordering the components. Return the newz value, reserving all the values that
	you require for your visual nodes.
--------
%copyText%
():(TextField) -
	Copy selected text in textfield into clipboard.
--------
%TEXTFIELD_ALIGNCENTERED%
[int] - constant for centered text alignment
--------
%mousePressed%
():(Component self, MouseEvent e, boolean mouseover)  - description from overloaded method of Component:

called if the mouse was pressed on the component. If mouseover is true,
	the mouse is actually on THIS component and not on one of its childs,
	which will create events too.
--------
%TEXTFIELD_ALIGNLEFT%
[int] - constant for left text alignment
--------
%pasteText%
():(TextField) -
	paste text from clipboard in textfield and overwrite the selection
--------
%onTextChanged%
():(TextField) - called if the text changed (ie. by user input).
--------
%hideVisibles%
():(Component self)  - description from overloaded method of Component:

called when visible objects (l2ds) are no longer visible
--------
%new%
(TextField):(class, int x,y,w,h, align) - creates a textfield with the
	given dimensions. The align value can be a constant from the TextField
	table (TEXTFIELD_ALIGNRIGHT, ...).
--------
%getText%
(string):(TextField,[from,[to] ]) - returns the text of the textfield, if
	bounds are given it returns the text within that range
--------
%insertText%
(int):(TextField, string tx, int at) - inserts the text at the specified
	index. Returns the index at which the insertion stoped.
--------
%getTextLength%
(int length):(TextField) - returns number of chars
--------
%cutText%
():(TextField) -
	Cut selected text in textfield into clipboard, deleting the selected text.
--------
%isFocusable%
(boolean):(TextField) - returns true if visible
--------
%TEXTFIELD_ALIGNRIGHT%
[int] - constant for right text alignment
--------
%mouseReleased%
():(Component self, MouseEvent e, boolean mouseover)  - description from overloaded method of Component:

called if the mouse was released on the component
--------
%toString%
(string):(TextField) - returns simple component representation
--------
%onAction%
():(TextField, String text) - called if the user pressed enter. Overload this to react on this
--------
%setText%
():(TextField,string,[boolean donnotfireevent]) - sets text of the textfield,
	causes onTextChanged call. If donnotfireevent is true, the onTextChanged
	function is not called.
--------
%setCursorCaretPosAtX%
():(TextField,x,boolean ignoreselectionstartset) -
	sets caret position to local pixel coordinate. If a third argument is passed and
	is true, the selectionstart is not repositioned.
--------
%replaceText%
(boolean):(TextField) - returns true if visible
--------
%onKeyTyped%
():(TextField, KeyEvent) - called if a key was typed on the textfield.
--------
%createVisibles%
():(Component self,l2dnode basel2d)  - description from overloaded method of Component:

called when a Component is now displayable
	(doesn't have to be visible)
--------
%showVisibles%
():(Component self)  - description from overloaded method of Component:

called when visible objects (l2ds) are now visible
--------
%getCursorCaretPosAtX%
(x):(TextField,x) -
	converts relative pixel coordinate in caret position 
--------

--------
{:Icon}
An Icon is a small gui element for graphical symbols. An Icon in Luxinia
	could be of any type - 2D, 3D, animated and so on, so this class should
	provide some basic interface definititions and functions to create, delete
	and hiding the graphical representation of the Icon.
@@

%surface%
[string] - surface that should be used for this icon
--------
%color%
([r,g,b,a]):(Icon,[r,g=1,b=1,a=1]) - Sets the color of the icon - might depend on implementation.
--------
%update%
():(Icon,reason) - function that is called if something has changed.
	The reason should be one of the constants defined in the Icon class and
	describes the reason why the icon was updated more precisly.
--------
%REASON.RESIZED%
{[string]}=resized - resized skin
--------
%setClip%
():(Icon,[x,y,w,h]) - sets clipping for icon or disables it if no clipping is passed
--------
%setLocation%
():(Icon,x,y) - sets new location for icon
--------
%onDestroy%
():(Icon) - called by the garbagecollector
--------
%visibleflag%
[boolean] - true if the icon should be visible, but depends if the visible resources exists
--------
%toString%
(string):(Icon) - called by the tostring function and returns a string
	representing the icon information
--------
%y%
[float] - position of the bounds of the icon
--------
%REASON.VISCHANGE%
{[string]}=vischange - vischange reason
--------
%clone%
(Icon):(Icon) - Creates a copy of this Icon ready to be used. Must be
	overloaded, otherwise an error is thrown.
--------
%z%
[float] - z position in l2d layer
--------
%height%
[float] - height of the icon
--------
%createVisibles%
():(Icon,l2dnode parent) - Creates all visible resources required for displaying the icon.
	Might get called even if the visible information have been created already.
--------
%REASON.COLORCHANGE%
{[string]}=colorchange - colorchange reason
--------
%deleteVisibles%
():(Icon) - frees resources that are required for displaying the icon.
	Might get called even if the visible information have been deleted.
--------
%setBounds%
():(Icon,x,y,w,h) - sets self.x, self.y, self.width and self.height to
	the given values and calls the update function
--------
%getWidth%
(w):(Icon) - returns width of the Icon
--------
%new%
(Icon):(class, [width,height]) - Sets
	metatable index to class. Per default, a skin does not create any visual
	objects during start. These must be created by calling createVisibles. 
--------
%REASON.CREATEDVIS%
{[string]}=createdvis - vischange reason
--------
%delete%
():(Icon) - deletes the icon. This function might get called multiple times so
	flag your icon once you have deleted it. Per default the deletefunction will
	call the deleteVisibles function. If your Icon does not require further
	resources you can leave it this way.
--------
%getClip%
([x,y,w,h]):(Icon) - gets clipping for icon or disables it if no clipping is passed
--------
%id%
[float] - l2d sortid
--------
%x%
[float] - position of the bounds of the icon
--------
%getHeight%
(h):(Icon) - returns height of the Icon
--------
%width%
[float] - width of the icon
--------
%getSize%
(w,h):(Icon) - returns width and height of the Icon
--------
%selectIcon%
():(Icon, icon) - Selects an Icon. This means a different representation
	of the same icon. If the icon is used by a Skin2D object, the Skin2D object
	will automaticly forward its selectSkin parameter to this function. So an
	icon that is assigned to a skin used by a component should provide the
	"surface" that are specific for this component.

	If no surface of that name exists the surface "default" is tried out, if that
	fails too the object handles the case on its own.
--------
%REASON.DELETEDVIS%
{[string]}=deletedvis - vischange reason
--------
%setVisibility%
():(Icon,boolean visible) - Shows or hides the icon. Only affects
	Icons that have created visible resources.
--------
%REASON.SKINCHANGE%
{[string]}=skinchange - skinchange reason
--------
%contains%
(boolean):(Icon, x,y)  - returns true if the specific pixel is clickable.
	Returns true per default
--------
%setSortID%
():(Icon, id)  - sets sortids for l2d sorting
--------
%setZ%
():(Icon, z)  - Z offset to l2dlayer
--------

--------
{Icon:ImageIcon}
ImageIcon objects are using textures to display little icons in GUIs.
	A texture can be used for multiple different icons.
@@

%new%
():(class,string/texture tex, width, height, blendmode, [table iconpositions], [table color]) -
	Creates image icon from texture. The texture can be either a string
	or a loaded textures. If a string is passed the texture is being loaded
	without texture compression (if it is on anyway).

	The width and height is going to be used as size for the icon.
	The blendmode is going to be used for the the icon.

	The iconpositions is an associative array contiaining values with the
	x,y coordinates and widths and heights of the parts of the texture to be used.
	The default entry is used if no value for the selected icon is found. Components
	will use names to load certain icons in different states (hovered, pressed,
	etc.) and you can specify here where the correct icon is to be found on
	the image. If no iconposition is passed, the whole texture is used as
	icon.

	All coordinates are in pixel coordinates.

	Per default, the filtering of the icon texture is deactivated if the
	size of the window is the same as the refsize for the drawn objects.
	Otherwise the filtering value is not touched. Be aware that the
	icons will look best if they are drawn in the same size as they really are.
--------

--------
{Icon:L2DIcon}

@@

%new%
():(class,width, height, oncreate, ondelete) -
	
--------

--------
{Icon:L3DIcon}
L3DIcon are displaing l3dmodels.
@@

%l3dScale%
():(class, float x,y,z) - sets scaling of the l3d icon
--------
%l3dPos%
():(class, float x,y,z) - sets position of the l3d icon
--------
%l3dRotdeg%
():(class, float x,y,z) - sets rotation of the l3d icon
--------
%new%
():(class,) -
	
--------

--------
{:MouseCursor}
	The mousecursor is a visual representation of the mouse. The graphical
	appearance can be customized.
	
@@

%showMouse%
([boolean]):([boolean]) - same as input.showMouse. If the mouse is visible,
	MouseCursor.enable will be true.
--------
%mouseL2D%
(l2dnode):([l2dnode],[hotspotx,hotspoty]) - returns the l2d that is used as
	mousecursor. If a l2dnode is passed as argument, the current
	mousecursor is replaced by the argument and the old l2dnode is
	returned. This might be the defaultmousecursor.
--------
%addMouseListener%
():(MouseListener ml) - adds a mouselistener which will be called
	if the eventmask fits the mouselistener's eventmask.
--------
%enable%
([boolean enabled]):([boolean enable]) - enables or disables or
	returns current state of mousecursor. Only a enabled mouse produces
	clickevents and movementevents. If the mousecursor of the operating
	system is not shown (see MouseCursor.showMouse), a custom mousecursor
	is shown instead.
--------
%prevpos%
(int x,y):() - Mouseposition in previous frame
--------
%removeMouseListener%
():(MouseListener ml) - removes a mouselistener
--------
%wasButtonPressed%
(boolean):(int button) - returns true if the button (0-2)
	was pressed during the last frame
--------
%pos%
([int x,y]):([int x,y]) - returns or sets current mouse cursor position.
	Generates a mouseevent that is delegated to the mousecursor's mouselistener list
	
--------

--------
{:MouseEvent}
A mouseevent is produced whenever the mouse is moved, dragged, clicked or
	hits an object. A MouseEvent cannot be modified once it was created.
@@

%button%
{[int]} - button that produced the mouseevent
--------
%py%
{[int]} - previous position of the mouse when mouseevent was produced
--------
%px%
{[int]} - previous position of the mouse when mouseevent was produced
--------
%isDragged%
(boolean):(MouseEvent) - true if the mouse was dragged
--------
%MOUSE_CLICKED%
[int] - eventtype if a mousebutton was pressed and released without moving
--------
%getDiff%
(int x,y):(MouseEvent) - returns difference between the two frames
--------
%isReleased%
(boolean):(MouseEvent) - true if the mouse was released
--------
%src%
{[int]} - source object that produced the mouseevent if available
--------
%MOUSE_ENTER%
[int] - eventtype if the mouse entered the source
--------
%downsince%
{[int]} - since which frame the mouse button was hold down
--------
%MOUSE_PRESSED%
[int] - eventtype if a mousebutton is pressed down
--------
%MOUSE_EXIT%
[int] - eventtype if the mouse exited the source
--------
%MOUSE_WHEEL%
[int] - eventtype if the mouse wheel was moved
--------
%MOUSE_MOVED%
[int] - eventtype if the mouse was moved
--------
%wheelmove%
{[int]} - difference between current and previous wheelposition
--------
%move%
(MouseEvent):(MouseEvent self, int x,y) - returns new Mouseevent
	with translated coordinates with given x,y
--------
%pwheel%
{[int]} - previously wheel position of mouse
--------
%set%
(MouseEvent):(MouseEvent self, int x,y,[wheel]) - returns new Mouseevent
	with new coordinates set to x and y, respecting the previous
	position.
--------
%new%
(MouseEvent):(int x,y,wheel,previousx,previousy,previouswheel,button,eventtype,any src) - creates a new mouseevent object
--------
%MOUSE_RELEASED%
[int] - eventtype if the mouse was released
--------
%eventtype%
{[int]} - eventtype of the occured mouseevent
--------
%toString%
{string}:(MouseEvent e) - returns a string representing the mouseevent.
	This function is called if the MouseEvent is converted to a string, i.e.
	when calling 'print(mymouseevent)'.
--------
%y%
{[int]} - position of the mouse when mouseevent was produced
--------
%x%
{[int]} - position of the mouse when mouseevent was produced
--------
%MOUSE_DRAGGED%
[int] - eventtype if the mouse was moved while holding a button
--------
%isPressed%
(boolean):(MouseEvent) - true if the mouse was pressed
--------
%isMoved%
(boolean):(MouseEvent) - true if the mouse was moved
--------
%isClicked%
(boolean):(MouseEvent) - true if the mouse was clicked
--------
%isWheeled%
(boolean):(MouseEvent) - true if the wheel was moved
--------
%wheel%
{[int]} - wheel position of mouse
--------

--------
{:MouseListener}
A mouselistener reacts on certain type of events and call a eventfunction.
@@

%1%
{[function]} - listener function
--------
%onEnter%
{[boolean]} - true if the mouselistener reacts on enterings
--------
%onWheel%
{[boolean]} - true if the mouselistener reacts on wheelmoves
--------
%onDragged%
{[boolean]} - true if the mouselistener reacts on dragging
--------
%onPressed%
{[boolean]} - true if the mouselistener reacts on presses
--------
%onExit%
{[boolean]} - true if the mouselistener reacts on mouseexists
--------
%2%
{[int]} - eventmask
--------
%onMoved%
{[boolean]} - true if the mouselistener reacts on moves
--------
%onClicked%
{[boolean]} - true if the mouselistener reacts on clicks
--------
%eventcall%
(boolean):(MouseListener self, MouseEvent e) - same as MouseListener.matches,
	but calls the listener's function instantly.
--------
%matches%
(boolean):(MouseListener self, MouseEvent e) - returns true if the mouselistener's
	eventmask matches the eventmask of the MouseEvent.
--------
%onReleased%
{[boolean]} - true if the mouselistener reacts on releases
--------
%new%
	(MouseListener):(function callback, [int eventFilter]) -
	creates a new MouseListener. The eventFilter is optional and can be
	created by creating the product of the specific events of interest (i.e.
	MouseEvent.MOUSE_MOVED*MouseEvent.MOUSE_CLICKED). If eventFilter is not
	given, the listenerfunction will be called on every mouseevent.

	The callback function's signature is
	 function listener (mouselistener, mouseevent)
	
--------

--------
{:Rectangle}
A 2D rectangle for hittests. 2D Rectangles are used as bounding
	boxes for the Component class.
@@

%getClosestSide%
(side):(Rectangle,x,y) - returns closest side to a given point, 1 top edge, 2... clockwise
--------
%3%
{[int]} - width
--------
%2%
{[int]} - y component
--------
%intersection%
([Rectangle]):(Rectangle a,b) - returns intersection of both triangles
	or nil if a and b do not intersect. If a or b is nil, nil is returned.
--------
%4%
{[int]} - height
--------
%new%
():([table class, [float x,y,width,height]/[Rectangle rect] ]) - creates a rectangle object with the 
	given values as attributes. If a parameter is not specified, 0 is used as
	default value.
--------
%toString%
(string):(Rectangle self) - returns a simple string representing this rectangle.
--------
%add%
():(Rectangle self, Rectangle r / float x,float y) - adds a point or 
	rectangle to the rectangle.
--------
%getCorners%
(x1,y1,x2,y2):(Rectangle) - returns top left and bottom right coordinates
--------
%intersects%
(boolean):(Rectangle self, Rectangle other) - returns true if both
	rectangles do intersect
--------
%translate%
():(Rectangle,x,y) - translates the rectangle
--------
%setBounds%
():(Rectangle self, float x,y,w,h) - sets bounds of the Rectangle
--------
%contains%
(boolean):(Rectangle r, float x,y) - returns true if the given point is 
	inside the rectangle. The borders of the rectangle are included.
--------
%1%
{[int]} - x component
--------
%area%
(area):(Rectangle self) - area of rectangle (width*height)
--------

--------
{:Skin2D}
The Skin2D class is a two dimensional graphical representation for
	abstract information. It defines the look and feel of components.

	I.e. this information could be a button. A skin does only have to provide some
	mechanisms for hiding, creating and deleting. Any class that requires a
	twodimensional representation (x,y,width,height) can use a skin to display
	itself. The skin takes only care about its graphical representation, its
	position and dimensions.

	Skins can provide multiple "surfaces". Surfaces are variations of a skin.
	Components may request certain surfacetypes for a skin (i.e. mouseover
	event) to change the visual appearance of the skin.

	A Skin can also provide mechanisms to show text on the label.
	
@@

%getIconSkinSelection%
([id]):(Skin2D) - returns current iconskinselection preference
--------
%iconalignhorizontal%
[float/string]=ALIGN.ICONTOLEFT - alignment for icon
--------
%iconalignvertical%
[float/string]=ALIGN.CENTER - alignment for icon
--------
%setIcon%
():(Skin2D,Icon,[iconskinname, [alignh,[alignv] ] ]) -
	sets the Icon to be used for this skin.
	The second parameter denotes the name of the skin that should be used for
	the icon when displayed. If it is nil, the currently set skinname for the
	icon (that can be nil) is not overwritten. If it is false, it will be
	set to nil, otherwise it is set to the given value. If the
	3rd and 4th parameter is not nil, the icon alignment is set to these values.
--------
%textvertical%
[float/string]=ALIGN.CENTER - alignment for text
--------
%ALIGN.TOP%
{[string]} - position information for label
--------
%icon%
[Icon]=nil - the icon for this skin
--------
%setClip%
():(Skin2D,[x,y,w,h]) - Sets clipping for skin. If no value is passed,
	the clipping is disabled. 
--------
%REASON.ICONCHANGED%
{[string]}=iconchanged - changed icon reason
--------
%defaultfont%
[string]=arial11-16x16 - fontname to be used as default
--------
%setIconMargin%
():(Skin2D,float margin) - margin arount the icon
--------
%setAutowidth%
():(Skin2D, on) - Autowidth will change the *visual* appearance of the
	component to a width that is chosen depending on the current size of
	the caption and/or icon. 
--------
%bound.y%
[float] - position y
--------
%REASON.DELETEDVIS%
{[string]}=deletedvis - vischange reason
--------
%z%
[float]=0 - z position in space
--------
%setIconSkinSelection%
():(Skin2D, [id]) - if a skiniconselection is present, it is preferred if
	the skin of the Skin2D object is changed, otherwise, the icon's selection is
	using the same name as the current skinname.
	
--------
%ALIGN.RIGHT%
{[string]} - position information for label
--------
%getBounds%
(x,y,w,h):(Skin2D) - returns location and dimension of skin
--------
%getPadding%
(float top,right,bottom,left):(Skin2D) - returns current padding values
--------
%getPreferredLocation%
(x,y):(Skin2D,x,y) - Returns position which is preferred by the skin.
	Since most textures are drawn filtered, a component might like to be
	positionend at an integer position.
--------
%bound.h%
[float] - height
--------
%pright%
[float] - current padding to right
--------
%ALIGN.ICONTOTOP%
{[string]} - position information for icon
--------
%ALIGN.BOTTOM%
{[string]} - position information for label
--------
%getSkinColor%
(float r,g,b,a):(Skin2D) - Primary RGBA Color for the skin
--------
%setBounds%
():(Skin2D,x,y,w,h) - sets location and dimension of skin.
	Calls sizechanged ("resize") - only if the size and position was truly changed!
--------
%setPadding%
():(Skin2D,float top,right,bottom,left,[string/table key=default]) -
	padding of text and icon to the sides, sets default valueif the key is not
	present. The key is used when a different skin is selected. The key
	can be a table of keys that should be assigned with the given padding values. 
--------
%bound.w%
[float] - width
--------
%setVisibility%
():(Skin2D,boolean visible) - sets visibility of the skin. Won't create
	visibles, call createvisibles. Calls update function
--------
%delete%
():(Skin2D) - deletes the skin. This function might get called multiple
	times so flag your skin once it got deleted. Per default it calls
	the deleteVisibles method. 
--------
%texthorizontal%
[float/string]=ALIGN.CENTER - alignment for text
--------
%getSelectedSkin%
(string):(Skin2D) - Returns the currently selected skin.
--------
%bounds%
[table] - contains bounds of image
--------
%REASON.SKINCHANGE%
{[string]}=skinchange - skinchange reason
--------
%getIcon%
([Icon]):(Skin2D) - gets the Icon to be used for this skin.
--------
%update%
():(Skin2D, string reason) - called if the visual appearance changed.
	The reason contains the source which caused the modification. Depending
	on your implementation, it might be useful to collect modifications until
	the frame is finaly really drawn.
--------
%getFontset%
(fontset):(Skin2D) - returns currently fontset
--------
%bound.x%
[float] - position x
--------
%setLabelFontSize%
():(Skin2D, spacing) - spacing of font for the label
--------
%ALIGN.ICONTOBOTTOM%
{[string]} - position information for icon
--------
%setSortID%
(nextid):(Skin2D,int id) - sets sortid for l2d sorting. Returns the
	next id that can be used without interfering the l2delements of the
	skin. Per default it reserves 4 elements.
--------
%pleft%
[float] - current padding to left
--------
%pbottom%
[float] - current padding to bottom
--------
%getFontColor%
(float r,g,b,a):(Skin2D) - RGBA Color for the label
--------
%onDestroy%
():(Skin2D) - called by garbagecollecter. Calls delete.
--------
%clone%
(Skin2D):(Skin2D) - returns a copy of the skin. This function MUST be
	overloaded, otherwise an error is thrown.
--------
%getLabelText%
([text]):(Skin2D) - gets the text for the skin. 
--------
%ALIGN.CENTER%
{[string]} - position information for label
--------
%REASON.NEWTEXT%
{[string]}=newtext - new label text
--------
%setSkinColor%
():(Skin2D, float r,g,b,a) - sets Primary RGBA Color for the skin
--------
%paddings%
[table] - table containing paddings for different skins
--------
%setIconAlignment%
():(Skin2D,string/number horizontal, vertical) - sets alignment for icon. If number is passed
	it is used as coordinate from the top left corner.
--------
%REASON.VISCHANGE%
{[string]}=vischange - vischange reason
--------
%getIconMargin%
(float margin):(Skin2D) - returns margin arount the icon
--------
%setLabelPosition%
():(Skin2D,horizontal,vertical) - sets position of label. The position
	can be a string as described in Skin2D.ALIGN or a number. 
--------
%ptop%
[float] - current padding to top
--------
%getPreferredSize%
(w,h):(Skin2D,w,h) - Returns preferred size of the skin. A skin may have a
	minimum or maximum size - or wants to be sized in multiplies of a certain
	size.
--------
%REASON.COLORCHANGED%
{[string]}=colorchanged - changed color (Skin/font) reason
--------
%copystylefrom%
():(Skin2D to,Skin2D from) - copies style of another skin (padding and iconmargin)
--------
%REASON.RESIZED%
{[string]}=resized - resized skin
--------
%getPreferredBounds%
(x,y,w,h):(Skin2D,x,y,w,h) - returns preferred bounds for this skin.
	Calls getPreferredSize and getPreferredLocation per default.
--------
%setClipping%
():(Skin2D,on) - Enables or disables clipping. 
--------
%setLocation%
():(Skin2D,x,y) - sets 2D location of skin (calls directly setBounds)
--------
%ALIGN.ICONTOLEFT%
{[string]} - position information for icon
--------
%currentskin%
[string]=default - current key of used skin
--------
%new%
(Skin2D):(class) - Sets
	metatable index to class. Per default, a skin does not create any visual
	objects during start. These must be created by calling createVisibles. 
--------
%REASON.CREATEDVIS%
{[string]}=createdvis - vischange reason
--------
%ALIGN.LEFT%
{[string]} - position information for label
--------
%setFontColor%
():(Skin2D, float r,g,b,a) - sets RGBA Color for the label
--------
%getClip%
([x,y,w,h]):(Skin2D) - Gets clipping for skin. If no value is returned,
	the clipping is disabled. 
--------
%id%
[int]=0 - sortid for l2dlistset
--------
%setFont%
():(Skin2D,[string fontname]) - Name of font to be used, pass nil (or nothing) if the defaultfont should be used
--------
%getClipping%
(boolean):(Skin2D) - returns clipping value
--------
%createVisibles%
():(Skin2D,l2dnode parent) - restores resources for visual representation
--------
%ALIGN.ICONTORIGHT%
{[string]} - position information for icon
--------
%setZ%
():(Skin2D,float z) - sets z offset in l2d system - 0 per default
--------
%toString%
(string):(Skin2D) - returns simple text representation of the skin. It is
	called whenever the tostring function is called.
--------
%setDimensions%
():(Skin2D,w,h) - sets width and height of skin (calls directly setBounds)
--------
%deleteVisibles%
():(Skin2D) - deletes resources for visual representation
--------
%contains%
(boolean):(Skin2D, x,y) - returns true (default) if the skin contains a
	certain pixel in local coordinates. This method can be overloaded to
	let the mouse pointing reject transparent areas on the skin.
--------
%setLabelText%
():(Skin2D, [text]) - sets the text for the skin. If no argument is nil
	or is missing the text is removed.
--------
%selectSkin%
(skin):(Skin2D) - returns currently selected skin
--------

--------
{Skin2D:StretchedSkinnedImage}
A skinned image is an image that uses a special texture to create a
	2D rectangle visual surface.

	The skin is created from 9 areas on the texture:

	 1 2 3
	 4 5 6
	 7 8 9

	The areas 1,3,7 and 9 (the corners) are not stretched, while
	2 and 8 are stretched horizontaly while 4 and 6 are stretched
	vertically. Area 5 is stretched in both dimensions, depending
	on the chosen dimension of the image.

	The SkinnedImage class can handle multiple verticaly aligned
	skins on one texture that can be displayed one per time.
@@

%new%
():(class,string/texture tex,float top,right,bottom,left, [table uvs]) -
	creates new object of given class and initializes the stretchedimageskin
	specific variables of this object.

	If the texture is a string, the texture is being loaded without compression.
	This has no effect if the image was loaded before with compression. This
	affects only configurations where compression is enabled.

	The 4 integer arguments top, right, bottom and left are the widths of
	the borders which are used in the way as the class description.

	The uvs are optional and can be used to specify regions on the texture to
	be used for a certain surface. The table must contain named arrays of
	coordinates, i.e. @@{default = {x,y,width,height}}@@ where the coordinates
	specify the regions to be used. Creating a single texture with multiple
	GUI components to be used is more efficient and easier to be created.
	The uvs must be named to provide different surfaces for instance, if assigned
	to a button, the button will ask for different surfaces if the button is
	clicked, hovered and so on. Look up the documentation on the components
	that are using skins for a detailed overview on the surfaces for skins.

	If no uvs are passed, the skin will stretch out for the whole image.
	If a requested surface in a skin is not specified in the uvs table, the
	whole image will be used also. Additionally the uvpositions can overload
	the margin widths. The format for the uvpositions is
	 {x, y, width, height, [top, left, right, bottom]}

	All coordinates are in absolute pixel coordinates.

	Per default, the filtering of the skin texture is deactivated if the
	size of the window is the same as the refsize for the drawn objects.
	Otherwise the filtering value is not touched. Be aware that the
	skins will look best if they are drawn in the same size as they really are.
	
--------

--------

--------
::lux_ext::
The LuaExt module contains lua code and descriptions that are from mainly 
from other lua projects. We always refer to the original sources and we 
want to point out here that most stuff in this module ist not written by us.

We include this here for completeness of the documentation inside Lua. 

We only list here software and documentations from projects that are published 
as GPL or MIT license. In case that you disagree with this, please tell us. 

!!Lua (from http://www.lua.org):
The standard Lua libraries provide useful functions that are implemented directly 
through the C API. Some of these functions provide essential services to the 
language (e.g., type and getmetatable); others provide access to "outside" services 
(e.g., I/O); and others could be implemented in Lua itself, but are quite 
useful or have critical performance requirements that deserve an implementation 
in C (e.g., sort).

All libraries are implemented through the official C API and are provided as 
separate C modules. Currently, Lua has the following standard libraries:

* basic library;
* package library;
* string manipulation;
* table manipulation;
* mathematical functions (sin, log, etc.);
* input and output;
* operating system facilities;
* debug facilities. 

Except for the basic and package libraries, each library provides all its 
functions as fields of a global table or as methods of its objects.

!!Sockets (from http://www.cs.princeton.edu/~diego/professional/luasocket/)
LuaSocket is a Lua extension library that is composed by two parts: a C core 
that provides support for the TCP and UDP transport layers, and a set of Lua 
modules that add support for functionality commonly needed by applications that 
deal with the Internet.

The core support has been implemented so that it is both efficient and simple to 
use. It is available to any Lua application once it has been properly 
initialized by the interpreter in use. The code has been tested and runs well 
on several Windows and Unix platforms.

Among the support modules, the most commonly used implement the SMTP 
(sending e-mails), HTTP (WWW access) and FTP (uploading and downloading 
files) client protocols. These provide a very natural and generic interface 
to the functionality defined by each protocol. In addition, you will find 
that the MIME (common encodings), URL (anything you could possible want to do 
with one) and LTN12 (filters, sinks, sources and pumps) modules can be 
very handy.

The library is available under the same terms and conditions as the Lua 
language, the MIT license. The idea is that if you can use Lua in a project, 
you should also be able to use LuaSocket.

Copyright © 2004-2005 Diego Nehab. All rights reserved.
Author: Diego Nehab 

--------
{:Clipboard}
The Clipboard class allows primitive text access on the clipboard.
@@

%getText%
(string):() - returns a string that is currently in the clipboard
--------
%setText%
():(string) - copies a string in the clipboard
--------

--------
{:GarbageCollector}
The GarbageCollector is a wrapper for the collectgarbage function for simplification.
@@

%count%
(double mem):() - returns the total memory in use by Lua (in Kbytes).
--------
%stop%
():() - stops the garbage collector.
--------
%restart%
():() - restarts the garbage collector.
--------
%collect%
():() - performs a full garbage-collection cycle.
--------
%step%
(boolean):(int n) - performs a garbage-collection step. The step "size" is
			controlled by arg (larger values mean more steps) in a non-specified
			way. If you want to control the step size you must tune experimentally
			the value of arg. Returns true if the step finished a collection cycle.
--------
%setStepMul%
(float previous):(float mulstepsize) - sets arg/100 as the
			new value for the step multiplier of the collector.
--------
%setPause%
(float previous):(float pause) - sets arg/100 as the new value
			for the pause of the collector
--------

--------
{:baselib}
All functions in this "class" are global values that can be used directly.

The basic library provides some core functions to Lua. If you do not include
this library in your application, you should check carefully whether you need
to provide implementations for some of its facilities.
@@

%xpcall%
(?):(f, err) -
			This function is similar to pcall, except that you can set a
			new error handler.

			xpcall calls function f in protected mode, using err as the error
			handler. Any error inside f is not propagated; instead, xpcall
			catches the error, calls the err function with the original error
			object, and returns a status code. Its first result is the status
			code (a boolean), which is true if the call succeeds without errors.
			In this case, xpcall also returns all results from the call, after
			this first result. In case of any error, xpcall returns false plus
			the result from err. 
--------
%tostring%
(?):(e) -
			Receives an argument of any type and converts it to a string in a
			reasonable format. For complete control of how numbers are converted,
			use string.format.

			If the metatable of e has a "__tostring" field, then tostring calls
			the corresponding value with e as argument, and uses the result of
			the call as its result. 
--------
%_VERSION%
 [string] - A global variable (not a function) that holds a
			string containing the current interpreter version. The current
			contents of this variable is "Lua 5.1".
--------
%rawset%
(?):(table, index, value) -
			Sets the real value of table[index] to value, without invoking any
			metamethod. table must be a table, index any value different from
			nil, and value any Lua value.
--------
%error%
():(string message [, int level]) -
			Terminates the last protected function called and returns message as
			the error message. Function error never returns.

			Usually, error adds some information about the error position at the
			beginning of the message. The level argument specifies how to get
			the error position. With level 1 (the default), the error position
			is where the error function was called. Level 2 points the error to
			where the function that called error was called; and so on. Passing
			a level 0 avoids the addition of error position information to the
			message. 
--------
%unpack%
(?):(list [, i [, j] ]) -
			Returns the elements from the given table. This function is equivalent to

			 return list[i], list[i+1], ..., list[j]

			except that the above code can be written only for a fixed number of
			elements. By default, i is 1 and j is the length of the list, as
			defined by the length operator.
--------
%load%
():(func [, string chunkname]) -
			Loads a chunk using function func to get its pieces. Each call to
			func must return a string that concatenates with previous results.
			A return of nil (or no value) signals the end of the chunk.

			If there are no errors, returns the compiled chunk as a function;
			otherwise, returns nil plus the error message. The environment of the
			returned function is the global environment.

			chunkname is used as the chunk name for error messages and debug
			information. 
--------
%rawget%
(?):(table, index) -
			Gets the real value of table[index], without invoking any metamethod.
			table must be a table and index any value different from nil.
--------
%pcall%
(?):(f, arg1, arg2, ...) -
			Calls function f with the given arguments in protected mode. This
			means that any error inside f is not propagated; instead, pcall
			catches the error and returns a status code. Its first result is the
			status code (a boolean), which is true if the call succeeds without
			errors. In such case, pcall also returns all results from the call,
			after this first result. In case of any error, pcall returns false
			plus the error message.
--------
%getfenv%
([table]):(function f) - Returns the current environment in use
			by the function. f can be a Lua function or a number that specifies
			the function at that stack level: Level 1 is the function calling
			getfenv. If the given function is not a Lua function, or if f is 0,
			getfenv returns the global environment. The default for f is 1.
--------
%dofile%
([returnvalues,...]):(string file, [arg1, ...]) -
			Opens the named file and executes its contents as a Lua chunk. When
			called without arguments, dofile executes the contents of the standard
			input (stdin). Returns all values returned by the chunk. In case of
			errors, dofile propagates the error to its caller (that is, dofile
			does not run in protected mode).

			The original lua dofile required relative pathes to the file location.
			This is different in Luxinia: Luxinia looks for a file recursivly in all
			pathes relative to each file that was called. 
--------
%type%
(?):(v) -
			Returns the type of its only argument, coded as a string. The possible
			results of this function are "nil" (a string, not the value nil),
			"number", "string", "boolean, "table", "function", "thread", and
			"userdata".
--------
%pairs%
(?):(t) - Returns three values: the next function, the table t,
			and nil, so that the construction

			 for k,v in pairs(t) do ... end

			will iterate over all key--value pairs of table t.

			See next for the caveats of modifying the table during its traversal.
--------
%next%
(?):(table [, index]) -
			Allows a program to traverse all fields of a table. Its first
			argument is a table and its second argument is an index in this
			table. next returns the next index of the table and its associated
			value. When called with nil as its second argument, next returns
			an initial index and its associated value. When called with the
			last index, or with nil in an empty table, next returns nil. If
			the second argument is absent, then it is interpreted as nil.
			In particular, you can use next(t) to check whether a table is empty.

			Lua has no declaration of fields. There is no difference between a field
			not present in a table or a field with value nil. Therefore,
			next only considers fields with non-nil values. The order in which
			the indices are enumerated is not specified, even for numeric
			indices. (To traverse a table in numeric order, use a numerical
			for or the ipairs function.)

			The behavior of next is undefined if, during the traversal, you
			assign any value to a non-existent field in the table. You may
			however modify existing fields. In particular, you may clear
			existing fields. 
--------
%select%
(?):(index, ...) -
			If index is a number, returns all arguments after argument number
			index. Otherwise, index must be the string "#", and select returns
			the total number of extra arguments it received.
--------
%assert%
(arg1,arg2,...):(boolean condition, [string msg]) - Issues an error when the
		value of its argument v is false (i.e., nil or false); otherwise, returns
		all its arguments. message is an error message; when absent, it defaults
		to "assertion failed!"
--------
%ipairs%
(function iterator, table t, 0):(table t) -
			Returns three values: an iterator function, the table t, and 0,
			so that the construction

			 for i,v in ipairs(t) do ... end

			will iterate over the pairs (1,t[1]), (2,t[2]), ..., up to the first
			integer key with a nil value in the table.

			See @@next@@ for the caveats of modifying the table during its traversal.
--------
%tonumber%
(?):(e [, base]) -
			Tries to convert its argument to a number. If the argument is
			already a number or a string convertible to a number, then tonumber
			returns this number; otherwise, it returns nil.

			An optional argument specifies the base to interpret the numeral.
			The base may be any integer between 2 and 36, inclusive. In bases
			above 10, the letter `A´ (in either upper or lower case) represents
			10, `B´ represents 11, and so forth, with `Z´ representing 35. In
			base 10 (the default), the number may have a decimal part, as well
			as an optional exponent part (see 2.1). In other bases, only unsigned
			integers are accepted. 
--------
%loadstring%
(function f):(string [, chunkname]) -
			Similar to load, but gets the chunk from the given string.

			To load and run a given string, use the idiom

			 assert(loadstring(s))()
			
--------
%print%
(?):(e1, e2, ...) -
			Receives any number of arguments, and prints their values to stdout,
			using the tostring function to convert them to strings. print is not
			intended for formatted output, but only as a quick way to show a
			value, typically for debugging. For formatted output, use
			string.format.
--------
%rawequal%
(?):(v1, v2) -
			Checks whether v1 is equal to v2, without invoking any metamethod.
			Returns a boolean.
--------
%setfenv%
(?):(f, table) -
			Sets the environment to be used by the given function. f can be a
			Lua function or a number that specifies the function at that stack
			level: Level 1 is the function calling setfenv. setfenv returns the
			given function.

			As a special case, when f is 0 setfenv changes the environment of
			the running thread. In this case, setfenv returns no values. 
--------
%collectgarbage%
([table/value]):(string opt [, arg]) -
			This function is a generic interface to the garbage collector.
			It performs different
			functions according to its first argument, opt:
			* "stop" --- stops the garbage collector.
			* "restart" --- restarts the garbage collector.
			* "collect" --- performs a full garbage-collection cycle.
			* "count" --- returns the total memory in use by Lua (in Kbytes).
			* "step" --- performs a garbage-collection step. The step "size" is
			controlled by arg (larger values mean more steps) in a non-specified
			way. If you want to control the step size you must tune experimentally
			the value of arg. Returns true if the step finished a collection cycle.
			* "setpause" --- sets arg/100 as the new value for the pause of the
			collector.
			* "setstepmul" --- sets arg/100 as the new value for the step multiplier
			of the collector. 
--------
%_G%
[table] - A global variable (not a function) that holds the global
			environment (that is, _G._G = _G). Lua itself does not use this
			variable; changing its value does not affect any environment, nor
			vice-versa. (Use setfenv to change environments.)
--------
%getmetatable%
([table]):(object) - If object does not have a metatable,
			returns nil. Otherwise, if the object's metatable has a "__metatable"
			field, returns the associated value. Otherwise, returns the metatable
			of the given object. 
--------
%loadfile%
(function f):([string path]) -
			Similar to load, but gets the chunk from file filename or from the
			standard input, if no file name is given.
--------

--------
{:coroutine}
The operations related to coroutines comprise a sub-library of the basic
library and come inside the table coroutine. See 2.11 for a general description
of coroutines.
@@

%resume%
(?):(co [, val1, ..., valn]) -
			Starts or continues the execution of coroutine co. The first time
			you resume a coroutine, it starts running its body. The values val1,
			..., valn are passed as the arguments to the body function. If the
			coroutine has yielded, resume restarts it; the values val1, ...,
			valn are passed as the results from the yield.

			If the coroutine runs without any errors, resume returns true plus
			any values passed to yield (if the coroutine yields) or any values
			returned by the body function (if the coroutine terminates). If
			there is any error, resume returns false plus the error message. 
--------
%yield%
(?):([val1, ..., valn]) -
			Suspends the execution of the calling coroutine. The coroutine cannot
			be running a C function, a metamethod, or an iterator. Any arguments
			to yield are passed as extra results to resume. 
--------
%status%
(?):(co) - Returns the status of coroutine co, as a string:
			"running", if the coroutine is running (that is, it called status);
			"suspended", if the coroutine is suspended in a call to yield, or
			if it has not started running yet; "normal" if the coroutine is
			active but not running (that is, it has resumed another coroutine);
			and "dead" if the coroutine has finished its body function, or if
			it has stopped with an error. 
--------
%wrap%
(?):(f) -
			Creates a new coroutine, with body f. f must be a Lua function.
			Returns a function that resumes the coroutine each time it is called.
			Any arguments passed to the function behave as the extra arguments
			to resume. Returns the same values returned by resume, except the
			first boolean. In case of error, propagates the error. 
--------
%create%
(?):(function f) -
			Creates a new coroutine, with body f. f must be a Lua function.
			Returns this new coroutine, an object with type "thread". 
--------
%running%
(?):() - Returns the running coroutine, or nil when
			called by the main thread. 
--------

--------
{:debug}
This library provides the functionality of the debug interface to Lua programs.
You should exert care when using this library. The functions provided here should
be used exclusively for debugging and similar tasks, such as profiling. Please
resist the temptation to use them as a usual programming tool: They can be very
slow. Moreover, several of its functions violate some assumptions about Lua code
(e.g., that variables local to a function cannot be accessed from outside or that
userdata metatables cannot be changed by Lua code) and therefore can compromise
otherwise secure code.

All functions in this library are provided inside the debug table. 
@@

%getupvalue%
(?):(func, up) -
				This function returns the name and the value of the upvalue with
				index up of the function func. The function returns nil if there
				is no upvalue with the given index. 
--------
%debug%
():() -
			Enters an interactive mode with the user, running each string that
			the user enters. Using simple commands and other debug facilities,
			the user can inspect global and local variables, change their values,
			evaluate expressions, and so on. A line containing only the word
			cont finishes this function, so that the caller continues its
			execution.

			Note that commands for debug.debug are not lexically nested
			within any function, and so have no direct access to
			local variables. 
--------
%getfenv%
(table):(o) - Returns the environment of object o.
--------
%getmetatable%
(table):(object) -
				Returns the metatable of the given object or nil if it does
				not have a metatable. 
--------
%gethook%
(?):() -
				Returns the current hook settings, as three values:
				the current hook function, the current hook mask, and
				the current hook count (as set by the debug.sethook function).
--------
%setmetatable%
(?):(object, table) -
				Sets the metatable for the given object to the given table
				(which can be nil). 
--------
%setfenv%
(?):(object, table) -
				Sets the environment of the given object to the given table. 
--------
%traceback%
(?):([message]) - Returns a string with a traceback of the call
				stack. An optional message string is appended at the beginning
				of the traceback. This function is typically used with xpcall
				to produce better error messages. 
--------
%getinfo%
(?):(function [, what]) -
				Returns a table with information about a function. You can
				give the function directly, or you can give a number as the
				value of function, which means the function running at level
				function of the call stack: Level 0 is the current function
				(getinfo itself); level 1 is the function that called getinfo;
				and so on. If function is a number larger than the number of
				active functions, then getinfo returns nil.

				The returned table contains all the fields returned by
				lua_getinfo, with the string what describing which fields to
				fill in. The default for what is to get all information available.
				If present, the option `f´ adds a field named func with
				the function itself.

				For instance, the expression debug.getinfo(1,"n").name returns a
				name of the current function, if a reasonable name can be found,
				and debug.getinfo(print) returns a table with all available
				information about the print function. 
--------
%setlocal%
(?):(level, local, value) -
				This function assigns the value value to the local variable
				with index local of the function at level level of the stack.
				The function returns nil if there is no local variable with the
				given index, and raises an error when called with a level out of
				range. (You can call getinfo to check whether the level is valid.)
				Otherwise, it returns the name of the local variable. 
--------
%setupvalue%
(?):(func, up, value) -
				This function assigns the value value to the upvalue with
				index up of the function func. The function returns nil if
				there is no upvalue with the given index. Otherwise, it
				returns the name of the upvalue. 
--------
%sethook%
(?):(hook, mask [, count]) -
				Sets the given function as a hook. The string mask and the
				number count describe when the hook will be called. The string
				mask may have the following characters, with the given meaning:
				* "c" --- The hook is called every time Lua calls a function;
				* "r" --- The hook is called every time Lua returns from a function;
				* "l" --- The hook is called every time Lua enters a new line of code.
				With a count different from zero, the hook is called after every
				count instructions.

				When called without arguments, debug.sethook turns off the hook.

				When the hook is called, its first parameter is a string
				describing the event that has triggered its call: "call",
				"return" (or "tail return"), "line", and "count". For line
				events, the hook also gets the new line number as its second
				parameter. Inside a hook, you can call getinfo with level 2 to
				get more information about the running function (level 0 is the
				getinfo function, and level 1 is the hook function), unless the
				event is "tail return". In this case, Lua is only simulating the
				return, and a call to getinfo will return invalid data. 
--------
%getregistry%
(table):() - Returns the registry table (see 3.5). 
--------
%getlocal%
(?):(level, local) -
				This function returns the name and the value of the local
				variable with index local of the function at level level of
				the stack. (The first parameter or local variable has index 1,
				and so on, until the last active local variable.) The function
				returns nil if there is no local variable with the given index,
				and raises an error when called with a level out of range.
				(You can call debug.getinfo to check whether the level is valid.)

				Variable names starting with `(´ (open parentheses) represent
				internal variables (loop control variables, temporaries, and C
				function locals). 
--------

--------
{:ftp}
FTP (File Transfer Protocol) is a protocol used to transfer files between hosts. 
The ftp namespace offers thorough support to FTP, under a simple interface. The 
implementation conforms to RFC 959.

High level functions are provided supporting the most common operations. These 
high level functions are implemented on top of a lower level interface. Using 
the low-level interface, users can easily create their own functions to access 
any operation supported by the FTP protocol. For that, check the implementation.

To really benefit from this module, a good understanding of LTN012, Filters 
sources and sinks is necessary.

URLs MUST conform to RFC 1738, that is, an URL is a string in the form:

    [ftp://][<user>[:<password>]@]<host>[:<port>][/<path>][type=a|i] 

The following constants in the namespace can be set to control the 
default behavior of the FTP module:

* PASSWORD: default anonymous password.
* PORT: default port used for the control connection;
* TIMEOUT: sets the timeout for all I/O operations;
* USER: default anonymous user; 

 ftp.get(url)
 ftp.get{
  host = string,
  sink = LTN12 sink,
  argument or path = string,
  [user = string,]
  [password = string]
  [command = string,]
  [port = number,]
  [type = string,]
  [step = LTN12 pump step,]
  [create = function]
 }

The get function has two forms. The simple form has fixed functionality: it 
downloads the contents of a URL and returns it as a string. The generic form 
allows a lot more control, as explained below.

If the argument of the get function is a table, the function expects at least 
the fields host, sink, and one of argument or path (argument takes precedence). 
Host is the server to connect to. Sink is the simple LTN12 sink that will 
receive the downloaded data. Argument or path give the target path to the 
resource in the server. The optional arguments are the following:

* user, password: User name and password used for authentication. 
Defaults to "ftp:anonymous@anonymous.org";
* command: The FTP command used to obtain data. Defaults to "retr", but see example below;
* port: The port to used for the control connection. Defaults to 21;
* type: The transfer mode. Can take values "i" or "a". Defaults to 
whatever is the server default;
* step: LTN12 pump step function used to pass data from the server to 
the sink. Defaults to the LTN12 pump.step function;
* create: An optional function to be used instead of socket.tcp when 
the communications socket is created. 

If successful, the simple version returns the URL contents as a string, and 
the generic function returns 1. In case of error, both functions return nil 
and an error message describing the error.

 -- Log as user "anonymous" on server "ftp.tecgraf.puc-rio.br",
 -- and get file "lua.tar.gz" from directory "pub/lua" as binary.
 f, e = ftp.get("ftp://ftp.tecgraf.puc-rio.br/pub/lua/lua.tar.gz;type=i")

 -- load needed modules
 local ftp = require("socket.ftp")
 local ltn12 = require("ltn12")
 local url = require("socket.url")

 -- a function that returns a directory listing
 function nlst(u)
    local t = {}
    local p = url.parse(u)
    p.command = "nlst"
    p.sink = ltn12.sink.table(t)
    local r, e = ftp.get(p)
    return r and table.concat(t), e
 end

 ftp.put(url, content)
 ftp.put{
  host = string,
  source = LTN12 sink,
  argument or path = string,
  [user = string,]
  [password = string]
  [command = string,]
  [port = number,]
  [type = string,]
  [step = LTN12 pump step,]
  [create = function]
 }

The put function has two forms. The simple form has fixed functionality: 
it uploads a string of content into a URL. The generic form allows a lot more 
control, as explained below.

If the argument of the put function is a table, the function expects at least 
the fields host, source, and one of argument or path (argument takes precedence). 
Host is the server to connect to. Source is the simple LTN12 source that will 
provide the contents to be uploaded. Argument or path give the target path to 
the resource in the server. The optional arguments are the following:

* user, password: User name and password used for authentication. 
Defaults to "ftp:anonymous@anonymous.org";
* command: The FTP command used to send data. Defaults to "stor", but see example below;
* port: The port to used for the control connection. Defaults to 21;
* type: The transfer mode. Can take values "i" or "a". Defaults to 
whatever is the server default;
* step: LTN12 pump step function used to pass data from the server to the sink. 
Defaults to the LTN12 pump.step function;
* create: An optional function to be used instead of socket.tcp when the 
communications socket is created. 

Both functions return 1 if successful, or nil and an error message 
describing the reason for failure.

 -- Log as user "fulano" on server "ftp.example.com",
 -- using password "silva", and store a file "README" with contents 
 -- "wrong password, of course"
 f, e = ftp.put("ftp://fulano:silva@ftp.example.com/README", 
    "wrong password, of course")

 -- load the ftp support
 local ftp = require("socket.ftp")
 local ltn12 = require("ltn12")

 -- Log as user "fulano" on server "ftp.example.com",
 -- using password "silva", and append to the remote file "LOG", sending the
 -- contents of the local file "LOCAL-LOG"
 f, e = ftp.put{
  host = "ftp.example.com", 
  user = "fulano",
  password = "silva",
  command = "appe",
  argument = "LOG",
  source = ltn12.source.file(io.open("LOCAL-LOG", "r"))
 }

@@


--------
{:http}
HTTP (Hyper Text Transfer Protocol) is the protocol used to exchange 
information between web-browsers and servers. The http namespace offers 
full support for the client side of the HTTP protocol (i.e., the facilities 
that would be used by a web-browser implementation). The implementation 
conforms to the HTTP/1.1 standard, RFC 2616.

The module exports functions that provide HTTP functionality in different 
levels of abstraction. From the simple string oriented requests, through 
generic LTN12 based, down to even lower-level if you bother to look through 
the source code.

URLs must conform to RFC 1738, that is, an URL is a string in the form:

 [http://][<user>[:<password>]@]<host>[:<port>][/<path>] 

MIME headers are represented as a Lua table in the form:

 headers = {
   field-1-name = field-1-value,
   field-2-name = field-2-value,
   field-3-name = field-3-value,
   ...
   field-n-name = field-n-value
 }

Field names are case insensitive (as specified by the standard) and all 
functions work with lowercase field names. Field values are left unmodified.

Note: MIME headers are independent of order. Therefore, there is no problem 
in representing them in a Lua table.

The following constants can be set to control the default behavior of the 
HTTP module:

* PORT: default port used for connections;
* PROXY: default proxy used for connections;
* TIMEOUT: sets the timeout for all I/O operations;
* USERAGENT: default user agent reported to server. 

 http.request(url [, body])
 http.request{
  url = string,
  [sink = LTN12 sink,]
  [method = string,]
  [headers = header-table,]
  [source = LTN12 source],
  [step = LTN12 pump step,]
  [proxy = string,]
  [redirect = boolean,]
  [create = function]
 }

The request function has two forms. The simple form downloads a URL using the 
GET or POST method and is based on strings. The generic form performs any HTTP 
method and is LTN12 based.

If the first argument of the request function is a string, it should be an url. 
In that case, if a body is provided as a string, the function will perform a 
POST method in the url. Otherwise, it performs a GET in the url

If the first argument is instead a table, the most important fields are the 
url and the simple LTN12 sink that will receive the downloaded content. Any 
part of the url can be overridden by including the appropriate field in the 
request table. If authentication information is provided, the function uses 
the Basic Authentication Scheme (see note) to retrieve the document. If sink 
is nil, the function discards the downloaded data. The optional parameters 
are the following:

* method: The HTTP request method. Defaults to "GET";
* headers: Any additional HTTP headers to send with the request;
* source: simple LTN12 source to provide the request body. If there is a body, 
you need to provide an appropriate "content-length" request header field, or 
the function will attempt to send the body as "chunked" (something few servers 
support). Defaults to the empty source;
* step: LTN12 pump step function used to move data. Defaults to the LTN12 
pump.step function.
* proxy: The URL of a proxy server to use. Defaults to no proxy;
* redirect: Set to false to prevent the function from automatically following 
301 or 302 server redirect messages;
* create: An optional function to be used instead of socket.tcp when the 
communications socket is created. 

In case of failure, the function returns nil followed by an error message. 
If successful, the simple form returns the response body as a string, followed 
by the response status code, the response headers and the response status line. 
The complex function returns the same information, except the first return value 
is just the number 1 (the body goes to the sink).

Even when the server fails to provide the contents of the requested URL (URL not 
found, for example), it usually returns a message body (a web page informing the 
URL was not found or some other useless page). To make sure the operation was 
successful, check the returned status code. For a list of the possible values 
and their meanings, refer to RFC 2616.

Here are a few examples with the simple interface:

 -- connect to server "www.cs.princeton.edu" and retrieves this manual
 -- file from "~diego/professional/luasocket/http.html" and print it to stdout
 http.request{ 
    url = "http://www.cs.princeton.edu/~diego/professional/luasocket/http.html", 
    sink = ltn12.sink.file(io.stdout)
 }

 -- connect to server "www.example.com" and tries to retrieve
 -- "/private/index.html". Fails because authentication is needed.
 b, c, h = http.request("http://www.example.com/private/index.html")
 -- b returns some useless page telling about the denied access, 
 -- h returns authentication information
 -- and c returns with value 401 (Authentication Required)
 
 -- tries to connect to server "wrong.host" to retrieve "/"
 -- and fails because the host does not exist.
 r, e = http.request("http://wrong.host/")
 -- r is nil, and e returns with value "host not found"

And here is an example using the generic interface:

 -- load the http module
 http = require("socket.http")

 -- Requests information about a document, without downloading it.
 -- Useful, for example, if you want to display a download gauge and need
 -- to know the size of the document in advance
 r, c, h = http.request {
  method = "HEAD",
  url = "http://www.tecgraf.puc-rio.br/~diego"
 }
 -- r is 1, c is 200, and h would return the following headers:
 -- h = {
 --   date = "Tue, 18 Sep 2001 20:42:21 GMT",
 --   server = "Apache/1.3.12 (Unix)  (Red Hat/Linux)",
 --   ["last-modified"] = "Wed, 05 Sep 2001 06:11:20 GMT",
 --   ["content-length"] = 15652,
 --   ["connection"] = "close",
 --   ["content-Type"] = "text/html"
 -- }

Note: Some URLs are protected by their servers from anonymous download. For 
those URLs, the server must receive some sort of authentication along with the 
request or it will deny download and return status "401 Authentication Required".

The HTTP/1.1 standard defines two authentication methods: the Basic 
Authentication Scheme and the Digest Authentication Scheme, both explained 
in detail in RFC 2068.

The Basic Authentication Scheme sends <user> and <password> unencrypted to the 
server and is therefore considered unsafe. Unfortunately, by the time of this 
implementation, the wide majority of servers and browsers support the Basic 
Scheme only. Therefore, this is the method used by the toolkit whenever 
authentication is required.

 -- load required modules
 http = require("socket.http")
 mime = require("mime")

 -- Connect to server "www.example.com" and tries to retrieve
 -- "/private/index.html", using the provided name and password to
 -- authenticate the request
 b, c, h = http.request("http://fulano:silva@www.example.com/private/index.html")

 -- Alternatively, one could fill the appropriate header and authenticate
 -- the request directly.
 r, c = http.request {
  url = "http://www.example.com/private/index.html",
  headers = { authentication = "Basic " .. (mime.b64("fulano:silva")) }
 }
@@


--------
{:io}
The I/O library provides two different styles for file manipulation. The first
one uses implicit file descriptors; that is, there are operations to set a
default input file and a default output file, and all input/output operations
are over these default files. The second style uses explicit file descriptors.

When using implicit file descriptors, all operations are supplied by table io.
When using explicit file descriptors, the operation io.open returns a file
descriptor and then all operations are supplied as methods of the file
descriptor.

The table io also provides three predefined file descriptors with their usual
meanings from C: io.stdin, io.stdout, and io.stderr.

Unless otherwise stated, all I/O functions return nil on failure (plus an error
message as a second result) and some value different from nil on success.

@@

%file:write%
(?):(value1, ...) - Writes the value of each of its
			arguments to the file. The arguments must be strings or numbers.
			To write other values, use tostring or string.format before write.
--------
%lines%
(?):([filename]) -
			Opens the given file name in read mode and returns an iterator
			function that, each time it is called, returns a new line from
			the file. Therefore, the construction

			 for line in io.lines(filename) do ... end

			will iterate over all lines of the file. When the iterator
			function detects the end of file, it returns nil (to finish
			the loop) and automatically closes the file.

			The call io.lines() (without a file name) is equivalent to
			io.input():lines(); that is, it iterates over the lines of
			the default input file. In this case it does not close the
			file when the loop ends. 
--------
%close%
(?):([file]) -
			Equivalent to file:close(). Without a file, closes the default
			output file. 
--------
%file:close%
(?):() - Closes file. Note that files are automatically closed
			when their handles are garbage collected, but that takes an
			unpredictable amount of time to happen. 
--------
%file:lines%
(?):() - Returns an iterator function that, each time it
			is called, returns a new line from the file. Therefore,
			the construction

			 for line in file:lines() do ... end

			will iterate over all lines of the file. (Unlike io.lines,
			this function does not close the file when the loop ends.)
--------
%file:setvbuf%
(?):(mode [, size]) -
			Sets the buffering mode for an output file.
			There are three available modes:

			* "no" --- no buffering; the result of any output operation appears
			immediately.
			* "full" --- full buffering; output operation is performed only when
			the buffer is full (or when you explicitly flush the file (see 5.7)).
			* "line" --- line buffering; output is buffered until a newline is
			output or there is any input from some special files (such as a
			terminal device).

			For the last two cases, sizes specifies the size of the buffer,
			in bytes. The default is an appropriate size.
--------
%file:read%
(?):(format1, ...) -
			Reads the file file, according to the given formats, which specify
			what to read. For each format, the function returns a string
			(or a number) with the characters read, or nil if it cannot
			read data with the specified format. When called without formats, it
			uses a default format that reads the entire next line (see below).

			The available formats are

			* "*n" reads a number; this is the only format that returns a
			number instead of a string.
			* "*a" reads the whole file, starting at the current position.
			On end of file, it returns the empty string.
			* "*l" reads the next line (skipping the end of line), returning
			nil on end of file. This is the default format.
			* number reads a string with up to this number of characters,
			returning nil on end of file. If number is zero, it reads nothing
			and returns an empty string, or nil on end of file. 
--------
%popen%
(?):([prog [, mode] ]) -
			Starts program prog in a separated process and returns a file
			handle that you can use to read data from this program
			(if mode is "r", the default) or to write data to this program
			(if mode is "w").

			This function is system dependent and is not available on all platforms.
--------
%write%
(?):(value1, ...) - Equivalent to io.output():write. 
--------
%flush%
(?):() - Equivalent to file:flush over the default output file. 
--------
%open%
(?):(filename [, mode]) -
			This function opens a file, in the mode specified in the string mode.
			It returns a new file handle, or, in case of errors, nil plus an
			error message.

			The mode string can be any of the following:

			* "r" --- read mode (the default);
			* "w" --- write mode;
			* "a" --- append mode;
			* "r+" --- update mode, all previous data is preserved;
			* "w+" --- update mode, all previous data is erased;
			* "a+" --- append update mode, previous data is preserved, writing is
			only allowed at the end of file.

			The mode string may also have a `b´ at the end, which is needed in
			some systems to open the file in binary mode. This string is exactly
			what is used in the standard C function fopen.
--------
%output%
(?):([file]) - Similar to io.input, but operates
			over the default output file.
--------
%read%
(?):(format1, ...) - Equivalent to io.input():read. 
--------
%file:seek%
():([whence] [, offset]) -
			Sets and gets the file position, measured from the beginning of
			the file, to the position given by offset plus a base specified by
			the string whence, as follows:

			* "set" --- base is position 0 (beginning of the file);
			* "cur" --- base is current position;
			* "end" --- base is end of file;

			In case of success, function seek returns the final file position,
			measured in bytes from the beginning of the file. If this function
			fails, it returns nil, plus a string describing the error.

			The default value for whence is "cur", and for offset is 0. Therefore,
			the call file:seek() returns the current file position, without
			changing it; the call file:seek("set") sets the position to the
			beginning of the file (and returns 0); and the call file:seek("end")
			sets the position to the end of the file, and returns its size. 
--------
%input%
(?):([file]) -
			When called with a file name, it opens the named file (in text
			mode), and sets its handle as the default input file. When
			called with a file handle, it simply sets this file handle as the
			default input file. When called without parameters, it returns
			the current default input file.

			In case of errors this function raises the error, instead of
			returning an error code. 
--------
%type%
(obj):() - Checks whether obj is a valid file handle.
			Returns the string "file" if obj is an open file handle,
			"closed file" if obj is a closed file handle, or nil if obj is
			not a file handle.
--------
%file:flush%
(?):() - Saves any written data to file. 
--------
%tmpfile%
(?):() - Returns a handle for a temporary file. This file is
			opened in update mode and it is automatically removed when the
			program ends. 
--------

--------
{:math}
This library is an interface to the standard C math library. It provides all
its functions inside the table math. The library provides the following functions:

       math.abs     math.acos    math.asin    math.atan    math.atan2
       math.ceil    math.cos     math.cosh    math.deg     math.exp
       math.floor   math.fmod    math.frexp   math.ldexp   math.log
       math.log10   math.max     math.min     math.modf    math.pow
       math.rad     math.random  math.randomseed           math.sin
       math.sinh    math.sqrt    math.tan     math.tanh

plus a variable math.pi and a variable math.huge, with the value HUGE_VAL.
Most of these functions are only interfaces to the corresponding functions in
the C library. All trigonometric functions work in radians. The functions
math.deg and math.rad convert between radians and degrees.

The function math.max returns the maximum value of its numeric arguments.
Similarly, math.min computes the minimum. Both can be used with 1, 2, or
more arguments.

The function math.modf corresponds to the modf C function. It returns two
values: The integral part and the fractional part of its argument. The
function math.frexp also returns 2 values: The normalized fraction and the
exponent of its argument.

The functions math.random and math.randomseed are interfaces to the simple
random generator functions rand and srand that are provided by ANSI C.
(No guarantees can be given for their statistical properties.) When called
without arguments, math.random returns a pseudo-random real number in the
range [0,1). When called with a number n, math.random returns a pseudo-random
integer in the range [1,n]. When called with two arguments, l and u,
math.random returns a pseudo-random integer in the range [l,u].
The math.randomseed function sets a "seed" for the pseudo-random generator:
Equal seeds produce equal sequences of numbers. 
@@


--------
{:os}
This library is implemented through table os.
@@

%exit%
(?):([code]) -
			Calls the C function exit, with an optional code, to terminate
			the host program. The default value for code is the success code. 
--------
%setlocale%
(?):(locale [, category]) -
			Sets the current locale of the program. locale is a string specifying
			a locale; category is an optional string describing which category to
			change: "all", "collate", "ctype", "monetary", "numeric", or "time";
			the default category is "all". The function returns the name of
			the new locale, or nil if the request cannot be honored. 
--------
%date%
(string date)([format [, time] ]) -
			Returns a string or a table containing date and time, formatted
			according to the given string format.

			If the time argument is present, this is the time to be formatted
			(see the os.time function for a description of this value).
			Otherwise, date formats the current time.

			If format starts with `!´, then the date is formatted in Coordinated
			Universal Time. After this optional character, if format is *t,
			then date returns a table with the following fields: year (four digits),
			month (1--12), day (1--31), hour (0--23), min (0--59), sec (0--61),
			wday (weekday, Sunday is 1), yday (day of the year), and isdst
			(daylight saving flag, a boolean).

			If format is not *t, then date returns the date as a string,
			formatted according to the same rules as the C function strftime.

			When called without arguments, date returns a reasonable date and
			time representation that depends on the host system and on the
			current locale (that is, os.date() is equivalent to os.date("%c")).
--------
%getenv%
(?):(varname) -
			Returns the value of the process environment variable varname, or
			nil if the variable is not defined.
--------
%difftime%
(?):(t2, t1) -
			Returns the number of seconds from time t1 to time t2. In POSIX,
			Windows, and some other systems, this value is exactly t2-t1. 
--------
%remove%
(?):(filename) -
			Deletes the file or directory with the given name. Directories must
			be empty to be removed. If this function fails, it returns nil,
			plus a string describing the error. 
--------
%time%
(int time):([table]) -
			Returns the current time when called without arguments, or a time
			representing the date and time specified by the given table. This
			table must have fields year, month, and day, and may have fields
			hour, min, sec, and isdst (for a description of these fields,
			see the os.date function).

			The returned value is a number, whose meaning depends on your system.
			In POSIX, Windows, and some other systems, this number counts the
			number of seconds since some given start time (the "epoch"). In
			other systems, the meaning is not specified, and the number returned
			by time can be used only as an argument to date and difftime. 
--------
%clock%
(int seconds):() -
			Returns an approximation of the amount in seconds of CPU time
			used by the program.
--------
%execute%
(?):([command]) -
			This function is equivalent to the C function system. It passes
			command to be executed by an operating system shell. It returns a
			status code, which is system-dependent. If command is absent, then
			it returns nonzero if a shell is available and zero otherwise. 
--------
%rename%
(?):(oldname, newname) -
			Renames file or directory named oldname to newname. If this
			function fails, it returns nil, plus a string describing the error.
--------
%tmpname%
(string):() -
			Returns a string with a file name that can be used for a
			temporary file. The file must be explicitly opened before its use
			and explicitly removed when no longer needed. 
--------

--------
{:package}
The package library provides basic facilities for loading and building
modules in Lua. It exports two of its functions directly in the global
environment: require and module. Everything else is exported in a table package.
@@

%preload%
[table] - A table to store loaders for specific modules (see require).
--------
%loadlib%
(?):(string libname, string funcname) -
			Dynamically links the host program with the C library libname.
			Inside this library, looks for a function funcname and returns this
			function as a C function. (So, funcname must follow the protocol
			(see lua_CFunction)).

			This is a low-level function. It completely bypasses the package
			and module system. Unlike require, it does not perform any path
			searching and does not automatically adds extensions. libname must
			be the complete file name of the C library, including if necessary
			a path and extension. funcname must be the exact name exported by
			the C library (which may depend on the C compiler and linker used).

			This function is not supported by ANSI C. As such, it is only
			available on some platforms (Windows, Linux, Mac OS X, Solaris,
			BSD, plus other Unix systems that support the dlfcn standard). 
--------
%cpath%
[string] -
			The path used by require to search for a C loader.

			Lua initializes the C path package.cpath in the same way it initializes
			the Lua path package.path, using the environment variable LUA_CPATH
			(plus another default path defined in luaconf.h). 
--------
%loaded%
[table] -
			A table used by require to control which modules are already loaded.
			When you require a module modname and package.loaded[modname] is
			not false, require simply returns the value stored there. 
--------
%path%
[string] -
			The path used by require to search for a Lua loader.

			At start-up, Lua initializes this variable with the value of the
			environment variable LUA_PATH or with a default path defined in
			luaconf.h, if the environment variable is not defined. Any ";;"
			in the value of the environment variable is replaced by the default
			path.

			A path is a sequence of templates separated by semicolons. For each
			template, require will change each interrogation mark in the
			template by filename, which is modname with each dot replaced by a
			"directory separator" (such as "/" in Unix); then it will try to
			load the resulting file name. So, for instance, if the Lua path
			is

			  "./?.lua;./?.lc;/usr/local/?/init.lua"

			the search for a Lua loader for module foo will try to load the
			files ./foo.lua, ./foo.lc, and /usr/local/foo/init.lua,
			in that order.
--------
%seeall%
(?):(module) - Sets a metatable for module with its __index field
			referring to the global environment, so that this module inherits
			values from the global environment. To be used as an option to
			function module. 
--------

--------
{:socket}
The socket namespace contains the core functionality of LuaSocket.

@@

%protect%
():(func) -
Converts a function that throws exceptions into a safe function. This function 
only catches exceptions thrown by the try and newtry functions. It does not 
catch normal Lua errors.

Func is a function that calls try (or assert, or error) to throw exceptions.

Returns an equivalent function that instead of throwing exceptions, returns nil 
followed by an error message.

Note: Beware that if your function performs some illegal operation that raises 
an error, the protected function will catch the error and return it as a string. 
This is because the try function uses errors as the mechanism to throw exceptions. 
--------
%source%
(?):(mode, socket [, length]) -
Creates an LTN12 source from a stream socket object.

Mode defines the behavior of the source. The following options are available:

* "http-chunked": receives data from socket and removes the chunked transfer 
coding before returning the data;
* "by-length": receives a fixed number of bytes from the socket. This mode 
requires the extra argument length;
* "until-closed": receives data from a socket until the other side closes 
the connection. 

Socket is the stream socket object used to receive the data.

The function returns a source with the appropriate behavior. 
--------
%gettime%
(?):() -
Returns the time in seconds, relative to the origin of the universe. 
You should subtract the values returned by this function to get meaningful values.

 t = socket.gettime()
 -- do stuff
 print(socket.gettime() - t .. " seconds elapsed")
--------
%select%
(?):(recvt, sendt [, timeout]) - 
Waits for a number of sockets to change status.

Recvt is an array with the sockets to test for characters available for reading. 
Sockets in the sendt array are watched to see if it is OK to immediately write 
on them. Timeout is the maximum amount of time (in seconds) to wait for a change 
in status. A nil, negative or omitted timeout value allows the function to block 
indefinitely. Recvt and sendt can also be empty tables or nil. Non-socket values 
(or values with non-numeric indices) in the arrays will be silently ignored.

The function returns a table with the sockets ready for reading, a table with the 
sockets ready for writing and an error message. The error message is "timeout" 
if a timeout condition was met and nil otherwise. The returned tables are 
associative, to simplify the test if a specific socket has changed status.

Important note: a known bug in WinSock causes select to fail on non-blocking 
TCP sockets. The function may return a socket as writable even though the socket 
is not ready for sending.

Another important note: calling select with a server socket in the receive 
parameter before a call to accept does not guarantee accept will return 
immediately. Use the settimeout method or accept might block forever. 
--------
%newtry%
(?):(finalizer) -
Creates and returns a clean try function that allows for cleanup before 
the exception is raised.

Finalizer is a function that will be called before try throws the exception. 
It will be called in protected mode.

The function returns your customized try function.

Note: This idea saved a lot of work with the implementation of protocols in LuaSocket:

 foo = socket.protect(function()
    -- connect somewhere
    local c = socket.try(socket.connect("somewhere", 42))
    -- create a try function that closes 'c' on error
    local try = socket.newtry(function() c:close() end)
    -- do everything reassured c will be closed 
    try(c:send("hello there?\r\n"))
    local answer = try(c:receive())
    ...
    try(c:send("good bye\r\n"))
    c:close()
 end)

--------
%_VERSION%
string -
This constant has a string describing the current LuaSocket version. 
--------
%connect%
(?):(address, port [, locaddr, locport]) - 
This function is a shortcut that creates and returns a TCP client object connected 
to a remote host at a given port. Optionally, the user can also specify the 
local address and port to bind (locaddr and locport). 
--------
%sink%
(?):(mode, socket) -
Creates an LTN12 sink from a stream socket object.

Mode defines the behavior of the sink. The following options are available:

* "http-chunked": sends data through socket after applying the chunked transfer 
coding, closing the socket when done;
* "close-when-done": sends all received data through the socket, closing the 
socket when done;
* "keep-open": sends all received data through the socket, leaving it open 
when done. 

Socket is the stream socket object used to send the data.

The function returns a sink with the appropriate behavior. 
--------
%bind%
(?):(address, port [, backlog]) - 
This function is a shortcut that creates and returns a TCP server 
object bound to a local address and port, ready to accept client 
connections. Optionally, user can also specify the backlog argument to the 
listen method (defaults to 32).

Note: The server object returned will have the option "reuseaddr" set to true.
--------
%skip%
(?):(d [, ret1, ret2 ... retN])
Drops a number of arguments and returns the remaining.

D is the number of arguments to drop. Ret1 to retN are the arguments.

The function returns retd+1 to retN.

Note: This function is useful to avoid creation of dummy variables:

 -- get the status code and separator from SMTP server reply 
 local code, sep = socket.skip(2, string.find(line, "^(%d%d%d)(.?)"))
--------
%sleep%
(?):(time) -
Freezes the program execution during a given amount of time.

Time is the number of seconds to sleep for. The function truncates time down to 
the nearest integer. 
--------
%_DEBUG%
boolean - This constant is set to true if the library was 
compiled with debug support.
--------
%try%
(?):(ret1 [, ret2 ... retN]) -
Throws an exception in case of error. The exception can only be caught by 
the protect function. It does not explode into an error message.

Ret1 to retN can be arbitrary arguments, but are usually the return values 
of a function call nested with try.

The function returns ret1 to retN if ret1 is not nil. Otherwise, it calls 
error passing ret2.

 -- connects or throws an exception with the appropriate error message
 c = socket.try(socket.connect("localhost", 80))
--------

--------
{:string}
From the official Lua Reference (http://www.lua.org):

This library provides generic functions for string manipulation, such as
finding and extracting substrings, and pattern matching. When indexing a
string in Lua, the first character is at position 1 (not at 0, as in C).
Indices are allowed to be negative and are interpreted as indexing backwards,
from the end of the string. Thus, the last character is at position -1, and so on.

The string library provides all its functions inside the table string. It
also sets a metatable for strings where the __index field points to the
metatable itself. Therefore, you can use the string functions in
object-oriented style. For instance, string.byte(s, i) can be written as
s:byte(i).

!!Patterns

A character class is used to represent a set of characters. The following
combinations are allowed in describing a character class:

* x (where x is not one of the magic characters ^$()%.[]*+-?) --- represents the
character x itself.
* . --- (a dot) represents all characters.
* %a --- represents all letters.
* %c --- represents all control characters.
* %d --- represents all digits.
* %l --- represents all lowercase letters.
* %p --- represents all punctuation characters.
* %s --- represents all space characters.
* %u --- represents all uppercase letters.
* %w --- represents all alphanumeric characters.
* %x --- represents all hexadecimal digits.
* %z --- represents the character with representation 0.
* %x (where x is any non-alphanumeric character) --- represents the character x.
This is the standard way to escape the magic characters. Any punctuation character
(even the non magic) can be preceded by a `%´ when used to represent itself in a pattern.

* [set] --- represents the class which is the union of all characters in set. A
range of characters may be specified by separating the end characters of the range
with a `-´. All classes %x described above may also be used as components in set.
All other characters in set represent themselves. For example, [%w_] (or [_%w])
represents all alphanumeric characters plus the underscore, [0-7] represents the
octal digits, and [0-7%l%-] represents the octal digits plus the lowercase letters
plus the `-´ character.

The interaction between ranges and classes is not defined. Therefore, patterns
like [%a-z] or [a-%%] have no meaning.

* [^set] --- represents the complement of set, where set is interpreted as above.

For all classes represented by single letters (%a, %c, etc.), the corresponding
uppercase letter represents the complement of the class. For instance, %S represents
all non-space characters.

The definitions of letter, space, and other character groups depend on the current
locale. In particular, the class [a-z] may not be equivalent to %l.

A pattern item may be

* a single character class, which matches any single character in the class;
* a single character class followed by `*´, which matches 0 or more repetitions
of characters in the class. These repetition items will always match the longest
possible sequence;
* a single character class followed by `+´, which matches 1 or more repetitions
of characters in the class. These repetition items will always match the longest
possible sequence;
* a single character class followed by `-´, which also matches 0 or more repetitions
of characters in the class. Unlike `*´, these repetition items will always match the
shortest possible sequence;
* a single character class followed by `?´, which matches 0 or 1 occurrence of a
character in the class;
* %n, for n between 1 and 9; such item matches a substring equal to the n-th
captured string (see below);
* %bxy, where x and y are two distinct characters; such item matches strings
that start with x, end with y, and where the x and y are balanced. This means
that, if one reads the string from left to right, counting +1 for an x and -1
for a y, the ending y is the first y where the count reaches 0. For instance,
the item %b() matches expressions with balanced parentheses.

A pattern is a sequence of pattern items. A `^´ at the beginning of a pattern
anchors the match at the beginning of the subject string. A `$´ at the end of
a pattern anchors the match at the end of the subject string. At other positions,
`^´ and `$´ have no special meaning and represent themselves.

A pattern may contain sub-patterns enclosed in parentheses; they describe
captures. When a match succeeds, the substrings of the subject string that
match captures are stored (captured) for future use. Captures are numbered
according to their left parentheses. For instance, in the pattern "(a*(.)%w(%s*))",
the part of the string matching "a*(.)%w(%s*)" is stored as the first
capture (and therefore has number 1); the character matching "." is captured
with number 2, and the part matching "%s*" has number 3.

As a special case, the empty capture () captures the current string position
(a number). For instance, if we apply the pattern "()aa()" on the string "flaaap",
there will be two captures: 3 and 5.

A pattern cannot contain embedded zeros. Use %z instead. 
@@

%double2bin%
(string):(number) - converts number in 8 chars with double precision (64bit)
--------
%char2bin%
(string):(number) - converts number in single char for numbers between -127 and 128 - rounded, no overflowcheck done
--------
%int2bin%
(string):(number) - converts number in 4 chars for numbers between -2147483647 and 2147483647 - rounded, no overflowcheck done
--------
%bin2float%
(number):(string) - converts 4 chars in a floating point number with float precisision
--------
%match%
([string ...]):(string s, string pattern, [int init]) -
				Looks for the first match of pattern in the string s.
				If it finds one, then match returns the captures from the pattern;
				otherwise it returns nil. If pattern specifies no captures, then
				the whole match is returned. A third, optional numerical argument
				init specifies where to start the search; its default value is 1
				and may be negative.
--------
%gmatch%
(function iterator):(string s, string pattern) -
Returns an iterator function that, each time it is called, returns the next
captures from pattern over string s.

If pattern specifies no captures, then the whole match is produced in each call.

As an example, the following loop

  s = "hello world from Lua"
  for w in string.gmatch(s, "%a+") do
    print(w)
  end

will iterate over all the words from string s, printing one per line. The next
example collects all pairs key=value from the given string into a table:

  t = {}
  s = "from=world, to=Lua"
  for k, v in string.gmatch(s, "(%w+)=(%w+)") do
    t[k] = v
  end

--------
%len%
(int n):(string s) - Receives a string and returns its length. The empty
				string "" has length 0. Embedded zeros are counted, so "a\000bc\000"
				has length 5.
--------
%l2dlen%
(len):(string) - returns length of string without invisible characters to l2dstring - in case of multiline
					the longes line count is returned
--------
%gsub%
():() -
Returns a copy of s in which all occurrences of the pattern have been replaced
by a replacement string specified by repl, which may be a string, a table, or
a function. gsub also returns, as its second value, the total number of
substitutions made.

If repl is a string, then its value is used for replacement. The character %
works as an escape character: Any sequence in repl of the form %n, with n
between 1 and 9, stands for the value of the n-th captured substring (see below).
The sequence %0 stands for the whole match. The sequence %% stands for a single %.

If repl is a table, then the table is queried for every match, using the first
capture as the key; if the pattern specifies no captures, then the whole match
is used as the key.

If repl is a function, then this function is called every time a match occurs,
with all captured substrings passed as arguments, in order; if the pattern
specifies no captures, then the whole match is passed as a sole argument.

If the value returned by the table query or by the function call is a string or
a number, then it is used as the replacement string; otherwise, if it is false
or nil, then there is no replacement (that is, the original match is kept in
the string).

The optional last parameter n limits the maximum number of substitutions
to occur. For instance, when n is 1 only the first occurrence of pattern
is replaced.

Here are some examples:

   x = string.gsub("hello world", "(%w+)", "%1 %1")
   --> x="hello hello world world"

   x = string.gsub("hello world", "%w+", "%0 %0", 1)
   --> x="hello hello world"

   x = string.gsub("hello world from Lua", "(%w+)%s*(%w+)", "%2 %1")
   --> x="world hello Lua from"

   x = string.gsub("home = $HOME, user = $USER", "%$(%w+)", os.getenv)
   --> x="home = /home/roberto, user = roberto"

   x = string.gsub("4+5 = $return 4+5$", "%$(.-)%$", function (s)
         return loadstring(s)()
       end)
   --> x="4+5 = 9"

   local t = {name="lua", version="5.1"}
   x = string.gsub("$name%-$version.tar.gz", "%$(%w+)", t)
   --> x="lua-5.1.tar.gz"

--------
%format%
(string formatted):(string format, e1, e2 ...) -
Returns a formatted version of its variable number of arguments following the
description given in its first argument (which must be a string). The format
string follows the same rules as the printf family of standard C functions.
The only differences are that the options/modifiers *, l, L, n, p, and h are
not supported and that there is an extra option, q. The q option formats a
string in a form suitable to be safely read back by the Lua interpreter: The
string is written between double quotes, and all double quotes, newlines,
embedded zeros, and backslashes in the string are correctly escaped when
written. For instance, the call

 string.format('%q', 'a string with "quotes" and \n new line')

will produce the string:

"a string with \"quotes\" and \
 new line"

The options c, d, E, e, f, g, G, i, o, u, X, and x all expect a number as
argument, whereas q and s expect a string.

This function does not accept string values containing embedded zeros. 
--------
%rep%
(string repeated):(string s, int n) - Returns a string that is the
				concatenation of n copies of the string s.
--------
%lower%
(string lowered):(string s) - Receives a string and returns a
				copy of this string with all uppercase letters changed to
				lowercase. All other characters are left unchanged. The definition
				of what an uppercase letter is depends on the current locale.
--------
%sub%
(string str):(string s, int i, [int j]) - Returns the substring
				of s that starts at i and continues
				until j; i and j may be negative. If j is absent, then it is
				assumed to be equal to -1 (which is the same as the string length).
				In particular, the call string.sub(s,1,j) returns a prefix of s
				with length j, and string.sub(s, -i) returns a suffix of s with length i.
--------
%l2dheight%
(height):(string) - returns number of \ns in text
--------
%bin2short%
(number):(string) - converts 2 chars in a number between -32767 and 32768
--------
%dumpstripped%
(string binarybytecode):(function f) -
Returns a string containing a binary representation of the given function,
so that a later loadstring on this string returns a copy of the function.

Any debug information is stripped out here. 
--------
%byte%
(int c1,...):(string str, [int i [,int j] ]) -
Returns the internal numerical codes of the characters s[i], s[i+1], ..., s[j].
The default value for i is 1; the default value for j is i.

Note that numerical codes are not necessarily portable across platforms. 
--------
%short2bin%
(string):(number) - converts number in 2 chars for numbers between -32767 and 32768 - rounded, no overflowcheck done
--------
%bin2double%
(number):(string) - converts 8 chars in a floating point number with double precisision
--------
%dump%
(string binarybytecode):(function f) -
Returns a string containing a binary representation of the given function,
so that a later loadstring on this string returns a copy of the function.
function must be a Lua function without upvalues.
--------
%char%
(string str):(int i1, int i2, ...) -
Receives 0 or more integers. Returns a string with length equal to the number of
arguments, in which each character has the internal numerical code equal to its
corresponding argument.

Note that numerical codes are not necessarily portable across platforms.

--------
%float2bin%
(string):(number) - converts number in 4 chars with float precision (32 bit)
--------
%bin2char%
(number):(string) - converts single char in a number between -127 and 128
--------
%reverse%
(string reversed):(string s) - Returns a string that is the
				string s reversed.
--------
%bin2int%
(number):(string) - converts 4 chars in a number between -2147483647 and 2147483648
--------
%exec%
(boolean success,...):(string cmd, [table env,[table param] ]) -
				executes the given cmd string and returns true if it was
				successful plus the return values from the function.
				Otherwise the compilation error is returned as
				second argument. 
--------
%find%
([int start, int end, string captures,...]):
(string s, string pattern, [int init[, plain] ]) -
Looks for the first match of pattern in the string s.

If it finds a match, then find returns the indices of s where this occurrence
starts and ends; otherwise, it returns nil. A third, optional numerical argument
init specifies where to start the search; its default value is 1 and may be
negative. A value of true as a fourth, optional argument plain turns off the
pattern matching facilities, so the function does a plain "find substring"
operation, with no characters in pattern being considered "magic". Note that
if plain is given, then init must be given as well.

If the pattern has captures, then in a successful match the captured values
are also returned, after the two indices. 
--------
%upper%
(string lower):(string str) - Receives a string and returns a
				copy of this string with all lowercase letters changed to
				uppercase. All other characters are left unchanged.
				The definition of what a lowercase letter is depends on
				the current locale.
--------

--------
{:table}
This library provides generic functions for table manipulation. It provides
all its functions inside the table table.

Most functions in the table library assume that the table represents an array
or a list. For these functions, when we talk about the "length" of a table we
mean the result of the length operator. 
@@

%keyintersection%
(table):(table1,table2,...) - returns a table that is a copy of table1
			without keys that are missing in the following tables.
--------
%insert%
(?):(table, [pos,] value) -
			Inserts element value at position pos in table, shifting up
			other elements to open space, if necessary. The default value
			for pos is n+1, where n is the length of the table,
			so that a call table.insert(t,x) inserts x at the end of table t. 
--------
%print%
():(table) - prints out all keys and their values - useful for debugging
--------
%count%
(int):(table) - returns total number of elements via complete traversion
--------
%maxn%
(int n):(table) - Returns the largest positive numerical index of
			the given table, or zero if the table has no positive numerical
			indices. (To do its job this function does a linear traversal of
			the whole table.) 
--------
%remove%
(value):(table [, pos]) -
			Removes from table the element at position pos, shifting down other
			elements to close the space, if necessary. Returns the value of the
			removed element. The default value for pos is n, where n is the length
			of the table, so that a call table.remove(t) removes the last
			element of table t. 
--------
%concat%
(string):(table [, sep [, i [, j] ] ]) -
			Returns table[i]..sep..table[i+1] ... sep..table[j]. The default
			value for sep is the empty string, the default for i is 1, and
			the default for j is the length of the table. If i is greater than
			j, returns the empty string.
--------
%reverse%
(table):(table) - reverses the indexes of the table (inplace).
			Returns the same table that was passed.
--------
%copy%
(table):(table) - makes a simple copy of that table, without respect to refered
			tables or values inside of that table
--------
%removen%
(value1, value2, ...):(table,int n[, int at) -
			removes n elements from. If 'at' is given, the function removes all
			values from that index on, decrementing the at index with each remove.
			The order of the removed objects is "normal", which means that it is
			not changed.
--------
%sort%
(?):(table [, comp]) -
			Sorts table elements in a given order, in-place, from table[1] to
			table[n], where n is the length of the table. If comp is given,
			then it must be a function that receives two table elements, and
			returns true when the first is less than the second (so that not
			comp(a[i+1],a[i]) will be true after the sort). If comp is not
			given, then the standard Lua operator < is used instead.

			The sort algorithm is not stable; that is, elements considered equal
			by the given order may have their relative positions changed by the
			sort.
--------
%merge%
(table):(table1,table2,...) - copies all passed tables in one table one after each other,
			overwriting previous keys with new values.
--------

--------

--------
::Luxinia Core Classes::
--------
{:capability}
Certain system (hardware related) capabilites can be queried for support here.
@@

%texcomb_combine4%
(boolean):() - returns support for combine4 in texcombiners
--------
%texcomb_dot3%
(boolean):() - returns support for dot3 in texcombiners
--------
%hwshadow%
(boolean):() - returns support for shadow map comparison and depth textures
--------
%fbo%
(boolean):() - returns support for framebufferobjects, allow enhanced rendertotexture. Especially rendering to multiple drawbuffers or textures with larger size than window. The rcmdfbo needs this capability.
--------
%texabgr%
(boolean):() - returns support for ABGR texture data
--------
%texdepthstencil%
(boolean):() - returns support for a packed format of 24bit depth and 8bit stencil texture.
--------
%texdds%
(boolean):() - returns support for dds texture loading
--------
%texautomipmap%
(boolean):() - returns support for automatic mipmaps
--------
%texnp2%
(boolean):() - returns support for non power of two texture dimensions. Currently only supported for 3d textures. For 2d textures use rectangle capability.
--------
%texfloat%
(boolean):() - returns support for float16 and float32 textures
--------
%stenciltwosided%
(boolean):() - returns support for two-sided stencil testing
--------
%texvertex%
(int):() - returns number of textures that can be accessed in vertex shader
--------
%texcompress%
(boolean):() - returns support for texture compression
--------
%tex3dsize%
(int):() - returns maximum dimension of 3d texture
--------
%vbo%
(boolean):() - returns support for vbo
--------
%texbgr%
(boolean):() - returns support for BGR,BGRA texture data
--------
%drawbuffers%
(int):() - returns maximum number of multiple render targets for color drawbuffers
--------
%texrectangle%
(boolean):() - returns support for rectangle textures
--------
%tex3d%
(boolean):() - returns support for 3d textures
--------
%dot3normalmap%
(boolean):() - returns support for VID_NORMAL combiner in shader system.
--------
%texcube%
(boolean):() - returns support for cubemap textures
--------
%texcomb_crossbar%
(boolean):() - returns support for access to all texture units in texcombiners
--------
%stencilwrap%
(boolean):() - returns support for wrapped increment and decrement
--------
%texcomb_subtract%
(boolean):() - returns support for subtract in texcombiners
--------
%texcomb_modadd%
(boolean):() - returns support for modulated add functions in texcombiners
--------

--------
{:console}
The console of luxinia is nothing more than  a screen containing lot's of letters. Each letter has a color and a style value that  can be set individually. The console has also a keyinput queue that represents the  keys that the user has pressed since the last frame. This queue is only filled if the  console is active.
@@

%clear%
():() - clears the console screen
--------
%active%
([boolean active]):([boolean active]) - returns activestatus if no arguments given and sets activestatus if arg is boolean
--------
%popstd%
([string err]):() - returns (if available) a line that was printed to standard stream. If you like to provide an mechanism that prints out information that comes from the Luxinia C core, you need to pop the messages from this queue.
--------
%width%
(int width):() - returns width of console
--------
%poperr%
([string err]):() - returns (if available) a line that was printed to error stream. If you like to provide an mechanism that prints out information that comes from the Luxinia C core, you need to pop the messages from this queue.
--------
%popKey%
([char key],[int keycode]):() - returns a key and its keycode, that was pressed or nil. tab,backspace and enter get converted to regular keycodes, all other special keys stay as original keycode
--------
%height%
(int height):() - returns height of console
--------
%put%
():(string text,[int style],[int r,g,b]) - writes the string given by text to the console. Stylecodes are: 
* 1: Bold
* 2: Italic
* 4: Underline
* 8: Strikeout
* 16: Smaller
If you want to combine the values, just make the sum of the styles you want to use(i.e. 2+4+16).
--------
%get%
(char c, int r,g,b,style):(int x,y) - Returns character information at given x,y
--------
%pos%
([int x,y]):([int x,y]) - returns position or sets position
--------

--------
{:fontset}
It defines how each character of a string is rendered. You can define what grid the font texture has, and which quad of the grid each character takes.
@@

%new16x16%
(fontset):()  - returns a new fontset with default values.
--------
%new6x6%
(fontset):()  - returns a new fontset with default values.
--------
%new8x8%
(fontset):()  - returns a new fontset with default values.
--------
%maxcharacters%
(int):(fontset)  - returns how many gridfields exist.
--------
%width%
([int]):(fontset,int character,[float width])  - returns or sets character width (0-1).
--------
%getdefault%
(fontset):()  - returns default fontset, you shouldnt change it as console and other drawings rely on it.
--------
%delete%
():(fontset)  - deletes the fontset.
--------
%lookup%
(int):(fontset,int character,[int gridfield])  - returns or sets which grid field should be used for this character. gridfield must be between 0 and maxcharacters
--------
%offsety%
([float]):(fontset,[float])  - returns or sets glyphoffset from topleft
--------
%offsetx%
([float]):(fontset,[float])  - returns or sets glyphoffset from topleft
--------
%linespacing%
([float]):(fontset,[float])  - returns or sets size of a line, default is 16
--------
%ignorespecials%
([boolean]):(fontset,[boolean])  - returns or sets if special command characters suchs as \n should be ignored.
--------
%new%
(fontset):([int size=16])  - returns a new fontset with default values. Allowed values for size are 6, 8 and 16. Size denotes the number of rows and columns in the fonttexture, which results in the number of glyphs for the font (36, 64 or 256).
--------

--------
{:fpubclass}
The luxinia API is provided by a system that we call functionpublishing. The functionpublishing is standalone and not bound to a certain scripting language. It also provides basic descriptions (like this text) and implements an objectoriented system of inheritance, even though Luxinia is written in pure C (which isn't an objectoriented programminglanguage). Every object that is created in the Luxinia C core is wrapped in a fpubclass which provides information about the class functions, parent classes and interface classes.
@hashid, @

%ischildof%
(boolean):(fpubclass child,fpubclass parent) - checks if the child is derived from parent
--------
%description%
([string]):(fpubclass) - returns description string for the class
--------
%classid%
(int):(fpubclass c) - returns the internal ID number of the class
--------
%parent%
([fpubclass]):(fpubclass) - returns the parent of the class if it has a parent
--------
%class%
([fpubclass/int]):(string/int/any) - returns the maximum number of classes that are registered in the functionpublishing (not all the numbers are registered classes) if no argument is given. If an int is applied, the class with this classid is returned. If a string is given, a class with that name is searched, and if an object is given, the class of the given object is returned. If a class was not found, nil is returned.
--------
%hasinterface%
(boolean):(fpubclass c, fpubclass interface) - checks if the class c implements the given interface class
--------
%functioninfo%
(int/[string name,string description]):(fpubclass, [int n/string name]) - returns the number of functions within this class (not within it's parents or interfaces). If n is provided, it returns the name and the description of the n'th function, where n is >= 0 and < the number of functions. If a string is passed, the return is the same as for n if the functinname is known.
--------
%name%
(string):(fpubclass) - returns the name of the given class
--------
%interface%
([int/fpubclass]):(fpubclass,[int index]) - returns the number of implemented interfaces. If an index is provided (>=0, <interfacecount) it returns the interface of the class
--------
%inherited%
(boolean):(fpubclass,string functionname) - returns true if the given function is inherited to child classes
--------
%isinterface%
(boolean):(fpubclass) - returns true if the given class is an interface class
--------

--------
{:hashid}
If an object should be used as a key in a table you need a method to retrieve a number from an object that is constant for this object. This interface implements such a method that can be used. The interface function has to guarantee that the same object returns the same number over the time. However it is not guaranteed that the number is unique.
@@

%hashid%
(int hashid):(object o) - returns the hashid of the given object.
--------

--------
{:input}
Luxinia's function publishing  does not offer direct calling of external functions if an event arises, such as key or mouseinputs. Instead, Luxinia saves event occurances in queues that can be processed when the scripting language is running.
@@

%joystick%
(boolean exists,[int joysticknr,int axiscount,int btncnt, float pos1,..., boolean btn1,...]):([int nr]) - returns joystick position and currently pressed buttons or false, if the given number does not exist. If no number is passed, joystick 0 is used. nr must be smaller than 16 and >= 0. Luxinia limits the number of axis to 8 and the number of buttons to 32, which should be enough.
--------
%popMouse%
([float x,y, int button, boolean isDown]):() - pops a mouseevent from queue
--------
%isMouseDown%
(boolean isDown):(int mousebutton) - returns true if the mousebutton is currently hold down. The mousebutton must be >=0 and <3 where 0 is the left, 1 the right and 2 the middle mousebutton. 
--------
%mouseWheel%
([int]):([int]) - sets or gets mousewheelposition
--------
%escquit%
([boolean on]):([boolean on]) - sets or gets quit when esc is pressed
--------
%popKey%
([int key, int keycode, boolean isDown]):() - pops a key from keyhistoryqueue. The key is the resulted char of the keyboard. The keycode is the number on the keyboard, which doesn't have to be a printable letter. In case of unprintable letters, key is 0.
--------
%mousePos%
([float x,y]):([float x,y]) - sets or gets mouseposition
--------
%isKeyDown%
(boolean isDown):(int keycode) - returns true if the key is pressed.
--------
%showmouse%
():(boolean visible) - sets mouse visibility. Only if the mouse is visible, it can be moved out from the window. The invisible mouse may have coordinates that are outside the window. Initially, the mouse is invisible. If the console is activated and deactivated, the visibilitystatus is set to invisible again.
--------

--------
{:l2dlist}
The List2D is drawn after the List3D and orthogonally. It is mainly used for HUD rendering text and buttons.		The origin 0,0 is top left, the width and height is independently of the current resolution, but defined in window.refsize. New nodes start unlinked and wont be drawn, unless linked to root or another root child. Drawing of l2dnodes is also possible via the rcmddrawl2d part of l3dview rendercommand system.
@@

%getroot%
(l2dnode):() - returns l2dlist master root node. Root doesn't inherit its position info.
--------
%getrcmdclear%
(rcmdclear):() - returns rcmdclear of the List2D.
--------

--------
{l2dlist:l2dnode}
A node meant for 2d drawing
@renderflag, hashid, @

%rotrad%
([float x,y,z]):(l2dnode,[float x,y,z]) - returns or sets l2dnode's rotation in radians
--------
%local2world%
(float x,y,z):(l2dnode,float x,y,z) - returns coordinates after transforms. l3dtargets will not be taken in account.
--------
%scissorparent%
([boolean]):(l2dnode,[boolean]) - returns or sets if parent's scissor information is used as well. If own node has no scissor set we will use parents, else we cap own with parent's 
--------
%scale%
([float x,y,z]):(l2dnode,[float x,y,z]) - returns or sets l2dnode's scale
--------
%scissor%
([boolean]):(l2dnode,[boolean]) - returns or sets if scissoring should be used. If scissoring is enabled only pixels within scissor rectangle are drawn. Makes sure proper scissorsize and scissorstart are set.
--------
%swapinchildlist%
():(l2dnode,l2dnode) - swaps the children within the parent's childlist.
--------
%rotdeg%
([float x,y,z]):(l2dnode,[float x,y,z]) - returns or sets l2dnode's rotation in degrees
--------
%delete%
():(l2dnode) - deletes node.
--------
%new%
(l2dnode):(string name)  - returns a new l2dnode, that can be used for hierarchy and organisation
--------
%sortid%
([int]):(l2dnode,[int]) - returns or sets l2dnode's sortid (lower gets rendered first). Setting a value will result into the parent's children list being resorted.
--------
%world2local%
(float x,y,z):(l2dnode,float x,y,z) - returns coordinates in localspace. l3dtargets will not be taken in account.
--------
%scissorstart%
([float x,y]):(l2dnode,[float x,y]) - returns or sets scissor rectangle startpoint. 
--------
%l3dtargetoff%
():(l2dnode node) - sets l3dtarget off
--------
%l3dtarget%
([l3dnode]):(l2dnode node,[l3dnode]) - returns or sets l3dtarget
--------
%parent%
([l2dnode]):(l2dnode,[l2dnode parent]) - returns or sets parent node. Will inherit transforms of parents and also won't be drawn if parent is not drawn. ==parent prevents gc of self, unless parent is root.
--------
%scissorlocal%
([boolean]):(l2dnode,[boolean]) - returns or sets if own scissorstart is transformed with the node's matrix. The size is not transformed.
--------
%firstchild%
([l2dnode]):(l2dnode,[l2dnode]) - returns or sets first child of the children list. First child is rendered first. Useful for manual sorting. 
--------
%pos%
([float x,y,z]):(l2dnode,[float x,y,z]) - returns or sets l2dnode's position
--------
%rotcenter%
([float x,y,z]):(l2dnode,[float x,y,z]) - returns or sets l2dnode's center of rotation
--------
%color%
([float r,g,b,a]):(l2dnode,[float r,g,b,a]) - returns or sets l2dnode's color
--------
%scissorsize%
([float x,y]):(l2dnode,[float x,y]) - returns or sets scissor rectangle size. 
--------
%get%
([l2dnode]):(string) - returns l2dnode with given name
--------

--------
{l2dnode:l2dflag}
list2d node that does only set some rendering parameters
@stencilcommand, @

%new%
(l2dflag):(string name) - returns a new l2dflag
--------

--------
{l2dnode:l2dimage}
a quad with the given material (or plain color) will be rendered on screen.
@vertexarray, indexarray, rendersurface, matobject, @

%fullscreen%
():(l2dimage)  - sets pos and scale for fullscreen
--------
%quadmesh%
():(l2dimage)  - deletes the usermesh and uses the quadmesh again (default).
--------
%quadcenteredmesh%
():(l2dimage)  - deletes the usermesh and uses the centered quadmesh again.
--------
%usermesh%
():(l2dimage, vertextype ,int maxvertices, int maxindices)  - gives the l2dimage a unique mesh. By default the mesh is just a quad which cannot be changed. With this function you can create your own mesh, as from this time on you can access it via vertexarray or indexarray interfaces. The new usermesh is completely empty, so make sure you fill it with content before it gets rendered the first time. If a previous usermesh existed it will be deleted. Polygonwinding is CW (not CCW like the others!).
--------
%matsurface%
([material/texture]):(l2dimage,[matsurface])  - returns or sets matsurface
--------
%new%
(l2dimage):(string name,matsurface)  - returns a new l2dimage
--------

--------
{l2dnode:l2dnode3d}
list2d node that links to a l3d node (l3dmodel,l3dprimitive,l3dtrail)
@@

%l3d%
([l3dnode]):(l2dnode3d,[l3dnode])  - returns or sets l3dnode
--------
%new%
(l2dnode3d):(string name,l3dnode)  - returns a new l2dlinkedl3d
--------

--------
{l2dnode:l2dtext}
allows text to be rendered on screen
@rendersurface, @

%posatchar%
(float x,y):(l2dtext, int pos)  - returns the character's position offset. Behaviour undefined if pos>length of text.
--------
%text%
(string):(l2dtext,[string])  - returns or sets text
--------
%fontset%
(fontset):(l2dtext,[fontset])  - returns or sets fontset.
--------
%font%
(texture):(l2dtext,[texture])  - returns or sets font texture
--------
%spacing%
(float):(l2dtext,[float])  - returns or sets font spacing, default is 16
--------
%charatpos%
(boolean inside, int charpos):(l2dtext, float x, float y)  - returns character index at given x,y. Returns true / false wether it x,y was inside or not.
--------
%size%
(float):(l2dtext,[float])  - returns or sets font size, default is 16
--------
%dimensions%
(float x,y,z):(l2dtext)  - returns dimension of space it would take when printed
--------
%new%
(l2dtext):(string name,string text,[fontset])  - returns a new l2dtext
--------

--------
{:l3dlist}
The List3D is the main rendering list, it contains l3dnodes that represent visual items. It is organised in l3dsets l3dlayerids and l3dviews. l3dviews can render l2dnodes thru special commands as well.
@@

%l3dlayercount%
(int):() - returns how many l3dlayers exist
--------
%l3dsetcount%
(int):() - returns how many l3dsets exist
--------
%fbotest%
([int stringtype, string message]):() - performs a test run on current rcmdfbo related setups. It takes enable flags of rcmds into account. Returns an error (+1) or warning(-1) string, or nothing if all is working.
--------

--------
{l3dlist:bonecontrol}
Allows manual control of bones in bonesystems found in l3dmodels.
@hashid, @

%rotaxis%
([float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz]):(bonecontrol,[float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz]) - returns or sets rotation axis, make sure they make a orthogonal basis.
--------
%activate%
():(bonecontrol,l3dmodel) - activates bonecontrol on given l3dmodel
--------
%iklookat%
([boolean]):(bonecontrol,[boolean]) - returns or sets if a lookat effect should be applied on the ik root as well (default is false)
--------
%newabs%
(bonecontrol):(boneid) - a new abs bonecontroller. The bone will takeover the target matrix or local matrix (pos/rot)
--------
%invertaxis%
([boolean]):(bonecontrol,[boolean]) - returns or sets if aim axis should be inverted
--------
%axis%
([int]):(bonecontrol,[int]) - returns or sets axis along we aim
--------
%newlookat%
(bonecontrol):(boneid) - a new lookat bonecontroller. The bone will orient the defined axis in such a way that it aims at the target
--------
%ikiterations%
([int]):(bonecontrol,[int]) - returns or sets iterations of IK chain. how many iterations of the full IK chain we will do if we are above threshold
--------
%target%
():(bonecontrol,[actnornode]/[scenenode]) - sets target for ik/abs/lookat, for abs it will overwrite the matrix. If no argument is passed then it will be unlinked.
--------
%ikallchildren%
([boolean]):(bonecontrol,[boolean]) - returns or sets if all affected children should be updated. By default (false) we only update the bone's parents.
--------
%newrelative%
(bonecontrol):(boneid) - a new relative bonecontroller, use pos/rot to manually rotate or move a bone
--------
%rotdeg%
(float x,y,z):(bonecontrol,[float x,y,z]) - returns or sets rotation in degrees
--------
%matrix%
(matrix16):(bonecontrol,[matrix16]) - returns or sets matrix
--------
%ikthreshold%
([float]):(bonecontrol,[float]) - returns or sets threshold of IK chain. if square distance is below threshold we stop
--------
%newik%
(bonecontrol):(boneid) - a new ik bonecontroller. The bone will try to reach the target location. The bone must have one parent.
--------
%ikdepth%
([int]):(bonecontrol,[int]) - returns or sets depth of IK chain. means how many steps up in hierarchy we go. number must be smaller than the parent chain this bone has.
--------
%rotrad%
(float x,y,z):(bonecontrol,[float x,y,z]) - returns or sets rotation in radians
--------
%deactivate%
():(bonecontrol) - deactivates bonecontrol
--------
%delete%
():(bonecontrol) - deletes the controller
--------
%pos%
(float x,y,z):(bonecontrol,[float x,y,z]) - returns or sets position
--------

--------
{l3dlist:l3dbatchbuffer}
l3dbatchbuffer contains precompiled models. It is meant for efficient rendering of static geometry. Every model affected is transformed using the current hierarchy informatons and its vertices and indices are modified, so that the models are stored in big chunks. Meshes then can be batched to minimize drawcalls.
@@

%delete%
():(l3dbatchbuffer) - destroys the batchbuffer and all content in it. All linked drawnodes will revert back to their models' meshes and become fully operational again.
--------
%new%
(l3dbatchbuffer):(l3dset,scenenode root) - returns a new l3dbatchbuffer for the given l3dset and scenenode. All models, that are part of the given l3dset and either directly or indirectly linked to the given scenenode or its children, will be added to the batchbuffer and get their vertex and index data from it. Animateable models or those marked as nonbatchable will not be added, neither those with unsupported primitive types (triangle fans,line loop,line strip, polygon). Properties such as color and renderscale will be ignored and reset. Note that the matrices are calculated with the latest information for affected l3dnodes and scenenodes, that means make sure the scene is properly set up before. l3dnodes that are linked to bones, will not be added, nor their children, as they are considered animated. You can still modify the resulting worldspace vertexdata via vertexarray/indexarray interface from the affected l3dmodels. <br>It is important that you do not change the models position/rotation after batchcompiling, as visibility culling is still based on those.<br> Avoid using matobject interfaces on batchcompiled geometry.
--------

--------
{l3dlist:l3dlayerid}
l3dlayerid used to assign l3dnodes directly, get it from l3dset. Only needed for manual assign. You can manually multipass render a single layer using the opcode commandstring.
@@


--------
{l3dlist:l3dnode}
l3dnodes of different classes represent any visual item	you want to draw, models, particles etc. Each l3dnode can have a subtree of l3dnodes, however visibilty is only	tested for the root l3dnode, so if the root is not visible, childs won't be either. For a l3dnode to become active	it must be linked with a actornode or scenenode, from which it will get its world position information.<br>	for more info on the order nodes are rendered see l3dset.<br>	Retrieving world positions and rotations can return wrong results. Because world updates are only done when the node	was visible. So they lag one frame behind. Alternatively you can use updateall to enforce uptodate world data.
@hashid, @

%localrotaxis%
([float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz]):(l3dnode node,[float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz]) - returns or sets local rotation axis, make sure they make a orthogonal basis.
--------
%color%
([float r,g,b,a]):(l3dnode node,[meshid],[float r,g,b,a]) - returns or sets node's color. Only used when rfNovertexcolor is set. Optionally can pass meshid for l3dmodels
--------
%rotationlock%
(boolean):(l3dnode node,int axis,[boolean state]) - returns or sets rotation lock. axis 0=X 1=Y 2=Z 3=All. Rotation lock is applied before local transforms.
--------
%uselookat%
([boolean]):(l3dnode,[boolean]) - gets or sets if node should face camera. Local updates are done post align.
--------
%localrotdeg%
([float x,y,z]):(l3dnode node,[float x,y,z]) - returns or sets local rotation in degrees
--------
%renderscale%
([float x,y,z]):(l3dnode node,[float x,y,z]) - returns or sets render scale factor. (1,1,1) will disable renderscale, which is cheaper to render. For l3dpemitters it applies scaling to subsystem offsets.
--------
%worldpos%
([float x,y,z]):(l3dnode node,[float x,y,z]) - returns or sets last world position. Setting only allowed if 'usemanualworld' is true.
--------
%localrotrad%
([float x,y,z]):(l3dnode node,[float x,y,z]) - returns or sets local rotation in radians
--------
%cambox%
():(l3dnode node,boolean inside,float outer min x,y,z,float outer max x,y,z,[float inner min x,y,z, float inner max x,y,z]) - sets visibility box, if camera is inside (inside set to true) / outside (inside set to false) the box it will be drawn. If you pass the second box,which must be smaller than the first, we will perform a ranged check. This means the node will be marked as inside if camera is within outer box, and outside of innerbox.
--------
%setlayer%
():(l3dnode,l3dlayerid,[meshid]) - sets the nodes layer/set. l3dmodels can pass meshid. An l3dset change always affects all
--------
%name%
(string name):(l3dnode node) - returns name
--------
%uselocal%
([boolean]):(l3dnode node,[boolean]) - enables local matrices, automatically on when you link to another l3dnode. You must not call it before the l3dnode was linked.
--------
%get%
([l3dnode]):(string name) - returns node with that name
--------
%novistest%
([boolean]):(l3dnode,[boolean]) - gets or sets novistest state. If set to true, node will always be drawn, as well as all its children. Not allowed to be set for children l3dnodes.
--------
%worldrotrad%
([float x,y,z]):(l3dnode node,[float x,y,z]) - returns or sets last world rotation in radians. Setting only allowed if 'usemanualworld' is true.
--------
%lightmap%
([texture]):(l3dnode node,[texture]) - sets or returns node's lightmap, if not a texture is passed as argument, it will be disabled.
--------
%unparentbone%
():(l3dnode node) - unlinks l3dnode from bone
--------
%worldrotaxis%
([float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz]):(l3dnode node,[float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz]) - returns or sets last world rotation axis, make sure they make a orthogonal basis. Setting only allowed if 'usemanualworld' is true.
--------
%lightmaptexmatrix%
([matrix16]):(l3dnode node,[matrix16]) - sets or returns node's lightmap texmatrix, if not a matrix16 is passed as argument, it will be disabled.
--------
%camvolumedelete%
():(l3dnode node) - removes the extra visibility test based on camera position
--------
%parentbone%
():(l3dnode node,string bonename) - tries to link node to parent's bonesystem
--------
%worldrotquat%
([float x,y,z,w]):(l3dnode node,[float x,y,z,w]) - returns or sets local rotation as quaternion. Setting only allowed if 'usemanualworld' is true.
--------
%delete%
():(l3dnode node) - deletes l3dnode, by default children are also deleted
--------
%visflag%
([boolean]):(l3dnode,int id 0-31,[boolean]) - gets or sets visiblity status for each id. If a camera's id is set to true, the l3dnode will be visible to it. By default all are visible to id 0, which is the default camera.
--------
%localrotquat%
([float x,y,z,w]):(l3dnode node,[float x,y,z,w]) - returns or sets local rotation as quaternion
--------
%isanimateable%
(boolean):(l3dnode) - checks if the l3dnode is a l3dmodel and if yes, if it can be animated. Won't throw an error if a valid l3d is passed.
--------
%worldrotdeg%
([float x,y,z]):(l3dnode node,[float x,y,z]) - returns or sets last world rotation in degrees. Setting only allowed if 'usemanualworld' is true.
--------
%camsphere%
():(l3dnode node,boolean inside,float outer range, [float inner range]) - sets visibilty sphere, if camera is inside (inside set to true) / outside (inside set to false) the sphere it will be drawn. If you pass the inner range we will perform a ranged check. This means the node will be marked as inside if camera is within outer sphere, and outside of inner sphere.
--------
%parent%
([l3dnode parent]):(l3dnode node,[l3dnode parent]) - links node to a parent. ==parent prevents gc of self
--------
%worldmatrix%
([matrix16]):(l3dnode node,[matrix16/ actornode / scenenode]) - returns or sets world matrix. Setting only allowed if 'usemanualworld' is true.
--------
%updateall%
():() - updates world positions of all l3d nodes, visible or not. Useful if you need that data after you created and linked l3ds.
--------
%localmatrix%
([matrix16]):(l3dnode node,[matrix16]) - returns or sets local matrix. As visibility culling is based on the scene/actornode using too much localposition offsets can create problems. You should rather create new actor/scenenodes in that case.
--------
%linkinterface%
([scenenode]/[actornode]):(l3dnode node,[scenenode]/[actornode]) - links l3dnode to interfaces of scenenode or actornode (or returns current)
--------
%unlink%
():(l3dnode node) - fully unlinks l3dnode, wont be drawn until linked again
--------
%localpos%
([float x,y,z]):(l3dnode node,[float x,y,z]) - returns or sets local position. As visibility culling is based on the scene/actornode using too much localposition offsets can create problems. You should rather create new actor/scenenodes in that case.
--------
%usemanualworld%
([boolean]):(l3dnode node,[boolean]) - enables manual world matrices. Bonelinking, inheritlocks and local matrices will be disabled. You must not call it before the l3dnode was linked.
--------

--------
{l3dnode:l3dcamera}
Cameras are used to render the frame.You can link them with actornodes or scenenodes. And activate them in specific l3dviews,or globally by making it the default camera. However there is always a default camera at startup.
@hashid, @

%useinfinitebackplane%
([boolean]):(l3dcamera,[boolean]) - returns or sets if this camera needs shadow projection and therefore infinite backplane should be used. (only works for perspective projection)
--------
%reflectplane%
([float x,y,z,w]):(l3dcamera,[float x,y,z,w]) - returns or sets reflection plane (worldspace).
--------
%usereflection%
([boolean]):(l3dcamera,[boolean]) - returns or sets if camera is reflected on the reflectplane. Useful for reflection rendering
--------
%manualprojection%
([boolean]):(l3dcamera,[boolean]) - returns or sets if manual projection matrix is used. That means aspect/frontplane.. will not modify projection matrix (settable via projmatrix).
--------
%clipplane%
([float x,y,z,w]):(l3dcamera,[float x,y,z,w]) - returns or sets clipping plane (worldspace). To make clipping useful the camera must be on the negative side of the plane.
--------
%new%
([l3dcamera]):(int id 1-31) - creates new camera. The id must be unique and a l3dnode must get an update to its visflag, if it should be visible to it.
--------
%projmatrix%
([matrix16]):(l3dcamera,[matrix16]) - returns or sets current projection matrix.
--------
%visflagid%
(int):(l3dcamera) - returns the id the camera was intialized with
--------
%projmatrixinv%
([matrix16]):(l3dcamera) - returns current inverse of projection matrix.
--------
%frontplane%
([float]):(l3dcamera,[float]) - returns or sets frontplane
--------
%toworld%
(float x,y,z):(l3dcamera,float x,y,z,[l3dview]) - computes screen position to world coordinates. The camera returns the coordinates seen from 0,0,0. You will need to transform the coordinate with a matrix, if you link the camera against an actornode/scenenode. If l3dview is not passed, we will use reference coordinates
--------
%toscreen%
(float x,y,z):(l3dcamera,float x,y,z) - computes screen position
--------
%toview%
(float x,y,z,w):(l3dcamera,float x,y,z,[w]) - computes position in modelview matrix. (w=1.0 default)
--------
%backplane%
([float]):(l3dcamera,[float]) - returns or sets backplane
--------
%getrect%
(4 float x,y,z):(l3dcamera,int axis,float distance) - computes viewable rectangle on the given plane.		axis is the plane normal 0 = X, 1 = Y, 2 = Z. Method returns 4 Vectors that lie on the plane, or nothing if plane		wasnt intersected by frustum limiting rays. hitpoint order is, top left, top right, right bottom, left bottom
--------
%cwfront%
([boolean]):(l3dcamera,[boolean]) - returns or sets if front faces are clockwise, default off. Is needed when reflection plane creates artefacts
--------
%default%
([l3dcamera]):([l3dcamera]) - returns or sets current global default camera
--------
%fov%
([float]):(l3dcamera,[float]) - returns or sets fov
--------
%aspect%
([float]):(l3dcamera,[float]) - returns or sets aspect ratio = width/height, if negative then current window aspect will be used.
--------
%useclipping%
([boolean]):(l3dcamera,[boolean]) - returns or sets if clipping plane should be used
--------
%forceupdate%
():(l3dcamera) - forces the camera matrix to be updated (synchronized with its linked interface). This is neccessary 		if you use the toscreen and toworld functions and changed the position of the camera.
--------
%nearpercentage%
([float]):(l3dcamera,[float]) - returns or sets percentage of what is considered near. range = backplane * nearpercentage. If a drawnode is closer than its drawn first. This helps making use of zbuffer better.
--------

--------
{l3dnode:l3dlevelmodel}
A model that is very large and contains static geometry. The model will be split into a subdivided visibility cubes. Meshes that contain 'lightmap_' in their texture string will get those auto-loaded and applied.
@rendersurface, renderflag, @

%lightmapcount%
(int):(l3dlevelmodel) - returns how many lightmaps are used.
--------
%lightmap%
(texture):(l3dlevelmodel,int i) - returns ith lightmap.
--------
%new%
([l3dlevelmodel]):(string name,[l3dlayerid],model,int separatorsx,y,z, [int minpolys]) - creates new l3dlevelmodel. Visibility cubes are generated with the given separations (>=1).
--------

--------
{l3dnode:l3dlight}
Lights illuminate models that have the lit renderflag set. There is one sunlight either global default or l3dset specific, just like cameras.Additionally there can be multiple FX lights in the world. All lights are pointlights without shadowing.The FX lights should have a smaller effective range, so that the engine can pick closest light to a node, becausethe number of lights at the same time is limited to 4 (1 sun, 3 fxlights).<br> Priority of FX lights will make no influence yet.<br>Lighting is done in hardware and uses following attenation formula:<br>1/(const+linear*distance+quadratic*distance*distance).<br>All lights' intensities are summed up and then multiplied with the vertexcolor.
@@

%fxnonsunlit%
([boolean]):(l3dlight,[boolean]) - returns or sets if the fxlight should affect nodes that are not sunlit (default is true). Can be useful to split lights into 2 categories: one affect all nodes (static scenery & moveable), and the other just fully dynamic lit nodes (moveable nodes). Be aware that l3dnodes will pick the lights per full node, not on a per mesh basis, if the first drawnode is just fxlit, we will use the nonsun lights.
--------
%activate%
():(l3dlight,int priority,float range,int duration) - adds light to FX light list, if duration is passed it will get auto deactivated. Priority is unused for now
--------
%attenuateconst%
([float]):(l3dlight,[float]) - returns or sets constant attenuation
--------
%makesun%
():(l3dlight) - makes it the default sun light
--------
%deactivate%
():(l3dlight) - removes light from FX light list
--------
%attenuatequadratic%
([float]):(l3dlight,[float]) - returns or sets quadratic attenuation
--------
%ambient%
([float r,g,b,a]):(l3dlight,[float r,g,b,[a]]) - returns or sets ambient intensity. Intensities can be negative and exceed 0-1. This way you can creater steeper falloffs. 
--------
%attenuatelinear%
([float]):(l3dlight,[float]) - returns or sets linear attenuation
--------
%rangeattenuate%
([boolean]):(l3dlight,[boolean]) - returns or sets state of automatic range based attenuation
--------
%diffuse%
([float r,g,b,a]):(l3dlight,[float r,g,b,[a]]) - returns or sets diffuse intensity. Intensities can be negative and exceed 0-1. This way you can creater steeper falloffs.
--------
%new%
([l3dlight]):(string name,l3dlayerid layer) - creates new light
--------

--------
{l3dnode:l3dmodel}
l3dnode of a model instance. Every l3dmodel has unique materials, bone and morph data, if specified. You can apply boneanimation with the sequence commands, control bones with bonecontrol or run morphing with morphcontrol. On creation the l3dmodel will copy all material and renderflags (if material provides a shader) data from the source model.
@rendersurface, renderflag, matobject, @

%bonerotdeg%
(float x,y,z):(l3dmodel,boneid/string bonename) - gets bone rotation degrees
--------
%bonereset%
():(l3dmodel) - sets bones to reference positions
--------
%seqDuration%
(int):(l3dmodel,int sequence) - returns duration of sequence
--------
%newinstance%
(l3dmodel):(string name,[l3dlayerid],l3dmodel) - creates instance of another l3dmodel, they will share bone and morph data. Only works if bone data is not set to worldspace.
--------
%seqOffset%
([int]):(l3dmodel,int sequence,[int]) - sets or returns current offset between anims of sequence, negative means overlapping. Dont call before anims were set. It will also set the proper duration for the sequence.
--------
%seqMax%
([int]):() - returns how many sequences can be set.
--------
%seqBlendfactor%
([float]):(l3dmodel,int sequence,[float]) - sets or returns blendfactor of sequence
--------
%seqSpeed%
([float]):(l3dmodel,int sequence,[float]) - sets or returns speed of sequence, default is 1
--------
%seqBlendmanual%
([boolean]):(l3dmodel,int sequence,[boolean]) - sets or returns if sequence is blended manually
--------
%seqLoop%
([boolean]):(l3dmodel,int sequence,[boolean]) - sets or returns if sequence loops, default is true
--------
%seqAnimsource%
([animation]):(l3dmodel,int sequence,int anim,[animation]) - sets or returns sequence:anim animation
--------
%getl3dbatchbuffer%
([l3dbatchbuffer]):(l3dmodel) - returns batchbuffer of the model, if it was batched.
--------
%nonbatchable%
([boolean]):(l3dmodel,[boolean]) - returns or sets state. If a batchbuffer affects this model it will not be included.
--------
%new%
(l3dmodel):(string name,[l3dlayerid],model,[boolean boneanim],[boolean meshanim]) - creates l3dmodel. If you want to be able to apply animations on it set boneanim to true. If you want it to have unique vertices or allow morphing set meshanim to true. (both default to false)
--------
%seqTime%
([int]):(l3dmodel,int sequence,[int]) - sets or returns current time of sequence
--------
%seqAnimMax%
([int]):() - returns how many anims per sequence can be set
--------
%projectorflag%
([boolean]):(l3dnode,int id,[boolean]) - returns or sets to which projectors the model reacts to. id is 0-31.
--------
%bonerotrad%
(float x,y,z):(l3dmodel,boneid/string bonename) - gets bone rotation radians
--------
%seqAnimstart%
([int]):(l3dmodel,int sequence,int anim,[int]) - sets or returns sequence:anim start time
--------
%seqState%
([int]):(l3dmodel,int sequence,[int state]) - sets or returns state of sequence. 0 inactive, 1 run, 2 pause, 3 singleframe
--------
%seqAnimlength%
([int]):(l3dmodel,int sequence,int anim,[int]) - sets or returns sequence:anim length
--------
%bonepos%
(float x,y,z):(l3dmodel,boneid/string bonename) - gets bone position
--------
%getvertexarray%
(vertexarray):(l3dmodel,meshid) - returns vertexarray of a batched or morphable l3dmodel's mesh.
--------
%matsurface%
([material/texture]):(l3dnode,meshid,[matsurface]) - sets or returns material of specific mesh
--------
%getmodel%
(model):(l3dnode) - returns model of this l3dnode
--------
%bonerotaxis%
(float Xx,Xy,Xz,Yx,Yy,Yz,Zx,Zy,Zz):(l3dmodel,boneid/string bonename) - gets bone rotation axis
--------
%getindexarray%
(vertexarray):(l3dmodel,meshid) - returns vertexarray of a batched l3dmodel's mesh.
--------
%bonesinworldspace%
([boolean]):(l3dmodel,[boolean]) - returns or sets if bones should be calculated in world space. If set in worldspace you cannot instance this l3dmodel, and you will get problems when others were already instanced.
--------
%bonematrix%
(matrix16):(l3dmodel,boneid/string bonename) - gets bone matrix
--------
%morphreset%
():(l3dmodel) - sets morphdata to reference positions
--------

--------
{l3dnode:l3dpemitter}
l3dnode of a particle emitter. Every emitter starts with the default values from the particle system. You can change the emittertype afterwards.<br><br>Important note about accessing subsystems: The l3dpemitter also hosts all subsystem emitters (all but trail, trail's common shared emitter is referenced), you can access them with a special ''subsys string'', that is made of the subsystem indices (0-based).<br>For example "0" accesses first subemitter, "12" the 2nd emitter of l3dpemitter and the 3rd of that one. An error is thrown when indexing is done out of bounds or on trail. You can use particlesys.getsubsysdigits to generate the string based on normal names. Be aware that if a trail subsystem is indexed, its default emitter (as used by trail effects) is modified. Also when a trail is used it wont report subsystems, as those are ignored in rendering as well.<br> Subsystem translation offsets can be scaled via renderscale.
@@

%getparticlesys%
(particlesys):(l3dpemitter,[subsys string])  - returns particlesys emitter was created from
--------
%spreadout%
([float]):(l3dpemitter,[subsys string],[float])  - returns or sets outer spread (radians)
--------
%typemodel%
():(l3dpemitter,[subsys string], model, float scale)  - sets emitter type to MODEL
--------
%axis%
([float]):(l3dpemitter,[subsys string],[int 0..2])  - returns or sets emitter plane normal axis for typerectangle
--------
%flipdirection%
([float]):(l3dpemitter,[subsys string],[float])  - returns or sets percent of flip direction
--------
%maxoffsetdist%
([float]):(l3dpemitter,[subsys string],[float])  - returns or sets max random offset from original spawnposition
--------
%prtsize%
([float]):(l3dpemitter,[subsys string],[float])  - returns or sets particle size
--------
%offsetvelocity%
([float x,y,z]):(l3dpemitter,[subsys string],[float x,y,z])  - returns or sets offset velocity
--------
%typerectangle%
():(l3dpemitter,[subsys string], float width, float height, [int axis])  - sets emitter type to RECTANGLE. Default plane normal is Z (2)
--------
%new%
(l3dpemitter):(string name,[l3dlayerid layer],particlesys)  - new particle emitter l3dnode (default type). The layer itself isnt important but the l3dset is extracted from it. Particlesys has a command to define in which layer it should be rendered.
--------
%height%
([float]):(l3dpemitter,[subsys string],[float])  - returns or sets emitter height for typerectangle(local)
--------
%startage%
([int]):(l3dpemitter,[subsys string],[int])  - returns or sets starting age of a particle
--------
%typepoint%
():(l3dpemitter,[subsys string])  - sets emitter type to POINT
--------
%rate%
([float]):(l3dpemitter,[subsys string],[float])  - returns or sets rate
--------
%radius%
([float]):(l3dpemitter,[subsys string],[float])  - returns or sets emitter radius for typecircle/typeshere. equivalent to size
--------
%typecircle%
():(l3dpemitter,[subsys string], float radius)  - sets emitter type to CIRCLE
--------
%typesphere%
():(l3dpemitter,[subsys string], float radius)  - sets emitter type to SPHERE
--------
%width%
([float]):(l3dpemitter,[subsys string],[float])  - returns or sets emitter width for typerectangles. equivalent to size
--------
%subsyscount%
(int):(l3dpemitter,[subsys string])  - returns how many subsys emitters are nested
--------
%velocityvar%
([float]):(l3dpemitter,[subsys string],[float])  - returns or sets velocityvar
--------
%stop%
():(l3dpemitter,int timeoffset,boolean norestarts)  - end with offset from now, disallow restarts
--------
%velocity%
([float]):(l3dpemitter,[subsys string],[float])  - returns or sets velocity
--------
%start%
():(l3dpemitter,int timeoffset)  - start with timeoffset(ms) from now
--------
%typerectanglelocal%
():(l3dpemitter,[subsys string], float width, float height)  - sets emitter type to RECTANGLELOCAL. width = along X axis, height = along Z axis
--------
%size%
([float]):(l3dpemitter,[subsys string],[float])  - returns or sets emitter size (radius,width)
--------
%spreadin%
([float]):(l3dpemitter,[subsys string],[float])  - returns or sets inner spread (radians)
--------

--------
{l3dnode:l3dpgroup}
list3d node of a particle group. The group can contain manually spawned particles, which will not perform any additional movement unless user changes them. The particles are transformed with the groups matrix in local types, also the renderscale is applied. There is 4 different types of particlegroups, only local/world allow manual spawning. All particles of the same particlecloud will be rendered at once, to optimize performance you should use as little particleclouds as possible. You can tweak particles appearance individually or update them all in one batch. When they spawn they will get default values, to assign those use 0 as particle in the prt??? functions, to update all particles' attributes you can pass 1 as particle.<br> Automatic particlegroups, such as typeworldref,typemodelvertices,typemodelbones remove their particles when references become invalid.
@@

%prtColor%
([float r,g,b,a]):(l3dpgroup,particle,[float r,g,b,a]) - gets or sets particle color. particlecloud must have particlecolor flag set to make it use the value.
--------
%usedrawlist%
([particle]):(l3dgroup,[particle]) - gets or sets if the manual drawlist should be used. You specify the list of particles that should be drawn with the drawlisthead/tail commands.
--------
%prtSize%
([float]):(l3dpgroup,particle,[float]) - gets or sets particle size.
--------
%remove%
():(l3dgroup,particle) - removes the particle, but performs no error checking, so any l3dpgroup could have spawned it belonging to the same particlecloud.
--------
%typeworld%
():(l3dgroup) - sets the grouptype to WORLD, particle coordinates are in worldspace
--------
%particlecount%
(int):(l3dgroup) - returns current particle count of the group.
--------
%typelocal%
():(l3dgroup) - sets the grouptype to LOCAL, particle coordinates are in localspace
--------
%rotvar%
([float]):(l3dgroup,[float]) - gets or sets rotationangle variance for spawned particles. outvalue = random [in-variance,in+variance]
--------
%removemulti%
([int count]):(l3dgroup,string cmds, ...) - removes multiple particles that fulfill all commands.<br>		The command string specifies what should be compared, and after the string each compare function has a different set of arguments: 

		* 't': seqeunce texid (comparemode,int) 

		* 'd': distance to point (comparemode,float x,y,z,distance) 

		* 's': size (comparemode,float) 

		e.g. grp:("td",comparemode.greater(),1,comparemode.less(),1,2,3,100)<br>		kicks all particles with texseqid greater than one and with distance to point(1,2,3) less than 100.
--------
%prtNormalworld%
([float x,y,z]):(l3dpgroup,particle) - gets or sets particle normal. Make sure to call l3dpgroup.updatetoworld, else positions might not be uptodate.
--------
%typemodelvertices%
():(l3dgroup,l3dmodel,meshid,float percent) - 		sets the grouptype to LOCAL, particle coordinates are in localspace and taken from the l3dmodel's vertices. 		You can specify how many percent of the mesh's surface you want to put particles on.
--------
%autorot%
([float]):(l3dgroup,[float]) - gets or sets automatic rotation in radians per second. Set to 0 to disable.
--------
%prtPos%
([float x,y,z]):(l3dpgroup,particle,[float x,y,z]) - gets or sets particle position, does not allow 'set all'
--------
%getfirst%
(particle):(l3dgroup) - returns first particle
--------
%autoscale%
([float]):(l3dgroup,[float]) - gets or sets automatic scaling add per second. scale = scale + (autoscale/second)*time
--------
%prtSwap%
():(l3dpgroup,particle,particle) - swaps content of the two particles.
--------
%prtPosworld%
([float x,y,z]):(l3dpgroup,particle) - gets or sets particle world position. Make sure to call l3dpgroup.updatetoworld, else positions might not be uptodate.
--------
%colorvar%
([float r,g,b,a]):(l3dgroup,[float r,g,b,a]) - gets or sets color variances. outvalue = random [in-variance,in+variance]
--------
%new%
(l3dgroup):(string name,[l3dlayerid layer],particlecloud)  - new particle group l3dnode. The layer itself isnt important but the l3dset is extracted from it. Particlecloud has a command to define in which layer it should be rendered.
--------
%usecolorvar%
([float]):(l3dgroup,[float]) - gets or sets if colorvariance is used for spawned particles.
--------
%spawnworldref%
(particle):(l3dgroup,[actornode]/[scenenode],int axis) - spawns a single particle that is autolinked to the given node. Axis is 0(X),1(Y),2(Z) and will mark the axis used for normals. Particle uses default values for the rest.
--------
%spawn%
(particle):(l3dgroup,float pos x,y,z,[float normal x,y,z]) - spawns a single particle, depending on the l3dpgroup type either in object coords or local coords. It will get the default particle values, to set those just pass 0 as particle in the prt??? functions.
--------
%prtSeq%
([int]):(l3dpgroup,particle,[int]) - gets or sets particle sequence number, the subtexture to be used if we have a sequencecount greater 1.
--------
%typemodelbones%
():(l3dgroup,l3dmodel,int axis,stringstack) - sets the grouptype to LOCAL, particle coordinates are in localspace and taken from the l3dmodel's bonesystem. Axis is 0(X),1(Y),2(Z) and will mark the axis used for normals, stringstack allows up to 128 items. To make sure the bones are updated before the particle group is activated and that their positions match, link the group as children to the l3dmodel.
--------
%updatetoworld%
():(l3dgroup) - transforms all particles to world state, using the current worldmatrix of the l3dpgroup. Can be useful if manual manipulation of the particles needs to be done.
--------
%prtPrev%
(particle):(l3dpgroup,particle) - returns prev particle or null if first. useful for manual iteration.
--------
%prtNext%
(particle):(l3dpgroup,particle) - returns next particle or null if last. useful for manual iteration.
--------
%autoseq%
([float]):(l3dgroup,[float]) - gets or sets automatic sequencing, time in ms until the next texid is used, simply loops thru seqeunces in the texture. 0 to disable
--------
%prtNormal%
([float x,y,z]):(l3dpgroup,particle,[float x,y,z]) - gets or sets particle normal, does not allow 'set all'.
--------
%drawlisttail%
([particle]):(l3dgroup,[particle]) - gets or sets particle that serves as trail of the drawlist when usedrawlist is enabled. Be aware that there is no error checking if the particle really belongs to this group, you will get undefined behavior if you assign particles from other groups.
--------
%sizevar%
([float]):(l3dgroup,[float]) - gets or sets size variance for spawned particles. outvalue = random [in-variance,in+variance]
--------
%prtRotangle%
([float]):(l3dpgroup,particle,[float]) - gets or sets particle rotation in radians. particlecloud must have rotate flag set to make it use the value.
--------
%drawlisthead%
([particle]):(l3dgroup,[particle]) - gets or sets particle that serves as head of the drawlist when usedrawlist is enabled. Be aware that there is no error checking if the particle really belongs to this group, you will get undefined behavior if you assign particles from other groups.
--------
%getparticlecloud%
(particlecloud):(l3dgroup) - returns particlecloud of group.
--------
%typeworldref%
():(l3dgroup) - sets the grouptype to WORLD_REFERENCE, particle coordinates are in worldspace, and auto linked to actornode or scenenode.
--------

--------
{l3dnode:l3dprimitive}
Primitives such as cubes, boxes and user meshes.
@vertexarray, indexarray, rendersurface, renderflag, matobject, @

%newbox%
([l3dprimitive]):(string name,[l3dlayerid],float w,d,h) - creates new l3dnode
--------
%originalmesh%
():(l3dprimitive)  - deletes the usermesh and uses the original mesh again.
--------
%newquadcentered%
([l3dprimitive]):(string name,[l3dlayerid],float w,d) - creates new l3dnode. origin of the quad is center point
--------
%newquad%
([l3dprimitive]):(string name,[l3dlayerid],float w,d) - creates new l3dnode. origin of the quad is lower left corner
--------
%matsurface%
([matsurface]):(l3dprimitive,[matsurface]) - returns or sets material
--------
%usermesh%
():(l3dprimitive, vertextype, int numverts, int numindices) - gives the l3dprimitive a unique mesh. 		By default the mesh is given by the type which cannot be changed. With this function you can create your own mesh, 		as from this time on you can access it via vertexarray or indexarray interfaces. 		The new usermesh is completely empty, so make sure you fill it with content before it 		gets rendered the first time. If a previous usermesh existed it will be deleted. Polygonwinding is CCW.
--------
%newcylinder%
([l3dprimitive]):(string name,[l3dlayerid],float size) - creates new l3dnode
--------
%newsphere%
([l3dprimitive]):(string name,[l3dlayerid],float size) - creates new l3dnode
--------
%size%
([float radius/float x,y,z]):(l3dprimitive,[float radius/float x,y,z]) - returns or sets size
--------

--------
{l3dnode:l3dprojector}
a projector allows textures to be		projected on models, orthogonally and perspectively. There is a special texture type that can fix 		backprojection errors for perpective projection, but shouldnt be used on orthogonal, or if no errors with normal textures appear.
@@

%projmatrix%
([matrix16]):(l3dprojector,[matrix16]) - returns or sets projection matrix. Using frontplane,aspect and so on will override manually set matrices.
--------
%textureid%
(texture):(l3dprojector,[texture]) - returns or sets projected texture
--------
%frontplane%
(float):(l3dprojector,[float]) - returns or sets projection frontplane distance
--------
%attenuate%
(boolean):(l3dprojector,[boolean]) - returns or sets attenuation, this is quite heavy effect but will perform a per pixel distance attenuation that causes the projector to fade out towards its backplane.
--------
%blend%
(blendmode):(l3dprojector,[blendmode]) - returns or sets blendmode of projector
--------
%backplane%
(float):(l3dprojector,[float]) - returns or sets projection backplane distance
--------
%deactivate%
():(l3dprojector) - removes projector from active list
--------
%fov%
(float):(l3dprojector,[float]) - returns or sets projection fov, when negative it will be orthogonal projection with abs(fov) rectangular size
--------
%activate%
():(l3dprojector,int id) - adds projector to the active list with given id (0-31)
--------
%aspect%
(float):(l3dprojector,[float]) - returns or sets projection aspect ratio = width/height
--------
%new%
(l3dprojector):(string name,[l3dlayerid layer]) - creates new projector
--------

--------
{l3dnode:l3dshadowmodel}
A volume model for stencil shadows. It takes meshdata from the original model, and renders only into the stencil buffer for the given light. Models will takeover bonelinks and skinobjects. You must use camera infinitebackplane in the view that contains the shadowmodels.
@@

%istargetvalid%
(boolean):(l3dshadowmodel)  - is target model/primitive still valid, if not you should delete the node.
--------
%islightvalid%
(boolean):(l3dshadowmodel)  - is light still valid, if not you should delete the node, or use another light
--------
%light%
([l3dlight]):(l3dshadowmodel,[l3dlight])  - returns or sets the light that is used. The light should be activated or sun, else its position is not updated.
--------
%extrusionlength%
([float]):(l3dshadowmodel,[float])  - returns or sets volume extrusion length. A value of 0 (default) means infinite length.
--------
%new%
([l3dshadowmodel]):(string name,[l3dlayerid],l3dlight,l3dprimitive/l3dmodel,[string meshname]) - creates a new l3dshadowmodel for the given nodes. When a l3dmodel is used you can specify a substring that is searched for in the l3dmodel's meshes. That way you can mark some meshes with nodraw/neverdraw in the original model, but use them as shadowmeshes and they still use the original animation/skin data. However when the original model is not visible, the animation data is not further updated. For l3dprimitives have in mind that you must not change the mesh after the shadowmodel was created.
--------

--------
{l3dnode:l3dtbterrain}
list3d node of a tbterrain
@@

%getterrain%
(tbterrain):(l3dnode node) - gets terrain of this l3dnode
--------
%new%
(l3dterrain):(string name,[l3dlayerid], tbterrain) - new l3dnode of tbterrain
--------

--------
{l3dnode:l3dtext}
A text node
@rendersurface, renderflag, @

%font%
([texture]):(l3dtext,[texture])  - returns or sets font texture
--------
%dimensions%
(float x,y,z):(l3dtext)  - returns dimension of space it would take when printed
--------
%spacing%
([float]):(l3dtext,[float])  - returns or sets font spacing, default is 16
--------
%size%
([float]):(l3dtext,[float])  - returns or sets font size, default is 16
--------
%text%
([string]):(l3dtext,[string])  - returns or sets text
--------
%fontset%
([fontset]):(l3dtext,[fontset])  - returns or sets fontset.
--------
%new%
([l3dtext]):(string name,[l3dlayerid],string text,[fontset]) - creates new l3dtext
--------

--------
{l3dnode:l3dtrail}
Contains a collection of points, that are rendered as a quad strip.
@rendersurface, renderflag, matobject, @

%closestpoint%
([float dist,trailpoint]):(l3dtrail,[float x,y,z]) - returns closest active trailpoint and distance to it. Last frame's state is used.
--------
%normalizedsize%
([float]) : (l3dtrail,[float]) - sets or returns size of an absolute ulength when materialnormalized is used (0 disables).
--------
%color%
([float r,g,b,a]):(l3dtrail,int step,[float r,g,b,a]) - sets or returns color interpolater at step. There is 0-2 steps, step 3 or -1 sets all.
--------
%drawlength%
([int]):(l3dtrail,[int])- sets or return drawlength of trail
--------
%tpPrev%
([trailpoint]):(l3dtrail,trailpoint) - gets previous trailpoint (or null).
--------
%usevelocity%
([boolean]):(l3dtrail,[boolean]) - sets or returns if velocity vector should be added
--------
%typeworld%
() : (l3dtrail) - local transforms are used on the points. You should do this after a new trail, or after resetting. (default)
--------
%tpPosarray%
([floatarray 3t]):(l3dtrail,[floatarray 3t])- sets or returns position of active trailpoints from floatarray
--------
%typelocal%
() : (l3dtrail) - local transforms are used on the points. You should do this after a new trail, or after resetting. It does not allow spawnstep.
--------
%size%
([float s]):(l3dtrail,int step,[float size]) - sets or returns size interpolater at step. There is 0-2 steps, step 3 or -1 sets all.
--------
%materialnormalized%
([boolean]) : (l3dtrail,[boolean]) - sets or returns if the material/texture is stretched in such a fashion that its width is the length of the trail. If materialscale was applied before uscale will be applied, too.
--------
%indexcolor%
([float r,g,b,a]):(l3dtrail,int step,[float r,g,b,a]) - sets or returns color at index. There is 0...length-1 steps. The regular color function creates linear interpolated values. This function lets you precisely modify every single value. However if you start using it, the regular color function will be ignored
--------
%materialscale%
():(l3dtrail,float length, width) - sets how often a material/texture is repeated/minified. length is along x axis 
--------
%closed%
([boolean]):(l3dtrail,[boolean]) - sets or returns if trail ends where it starts. The last added point will be skipped and the first is used instead, so add one more point than the ones you really need.
--------
%localtime%
([int]):(l3dtrail,[int]) - sets or returns trail's own localtime (in ms). Only active when uselocaltime is used.
--------
%reset%
():(l3dtrail) - clears all points
--------
%tpVelarray%
([floatarray 3t]):(l3dtrail,[floatarray 3t])- sets or returns velocity of active trailpoints from floatarray
--------
%planarmap%
([int]) : (l3dtrail,[int]) - sets or returns planar projection axis. -1 is none/disabled, 0 = x, 1 = y, z = 2. Materials will be projected along these axis.
--------
%planarscale%
([float]) : (l3dtrail,[float]) - sets or returns planarscale multiplier. texcoord = worldpos.projected * planarscale.
--------
%facecamera%
([bool]):(l3dtrail,[bool]) - sets or return facecamera flag
--------
%uselocaltime%
([boolean]):(l3dtrail,[boolean]) - sets or returns if trail uses its own localtime (in ms). If false(default) the global time by luxinia is used. All events such as spawstep, usevelocity and spawntime for manually created tpoints depend on this.
--------
%tpTime%
([int]):(l3dtrail,trailpoint,[int]) - gets or sets trailpoint's spawntime in ms.
--------
%new%
(trail):(string name,[l3dlayerid],int length) - a new trail system
--------
%indexsize%
([float r,g,b,a]):(l3dtrail,int step,[float r,g,b,a]) - sets or returns size at index. There is 0...length-1 steps. The regular size function creates linear interpolated values. This function lets you precisely modify every single value. However if you start using it, the regular size function will be ignored.
--------
%spawnworldref%
(trailpoint):(l3dtrail,actornode/scenenode,int axis) - spawns a single particle that is autolinked to the given node. Axis is 0(X),1(Y),2(Z) and will mark the axis used for normals. Only works if typeworldref is used.
--------
%tpVel%
([float x,y,z]):(l3dtrail,trailpoint,[float x,y,z]) - gets or sets trailpoint's position. Either local or world coordinates, depending on if trail:uselocalpoints is set.
--------
%spawnstep%
(int):(l3dtrail,[int])- sets or returns spawnstep in ms, one point will be spawned every spawnstep, if spanwstep is greater 0.
--------
%tpPos%
([float x,y,z]):(l3dtrail,trailpoint,[float x,y,z]) - gets or sets trailpoint's position. Either local or world coordinates, depending on if trail:uselocalpoints is set.
--------
%velocity%
([float x,y,z]):(l3dtrail,[float x,y,z]) - sets or returns velocity vector in local space, units per second.
--------
%matsurface%
([material/texture]):(l3dtrail,[matsurface]) - sets or returns matsurface
--------
%closestdistance%
([float dist,trailpoint,float fracc ]):(l3dtrail,[float x,y,z]) - returns closest line segment and distance to it. The closest point is fracc*(nexttpoint-tpoint). Last frame's state is used.
--------
%tpNext%
([trailpoint]):(l3dtrail,trailpoint) - gets next trailpoint (or null).
--------
%typeworldref%
() : (l3dtrail) - points take their world coordinates from linked references. You should do this after a new trail, or after resetting. It does not allow spawnstep.
--------
%tpNormalarray%
([floatarray 3t]):(l3dtrail,[floatarray 3t])- sets or returns normal of active trailpoints from floatarray
--------
%tpNormal%
([float x,y,z]):(l3dtrail,trailpoint,[float x,y,z]) - gets or sets trailpoint's position. Either local or world coordinates, depending on if trail:uselocalpoints is set.
--------
%spawn%
(trailpoint):(l3dtrail,float pos x,y,z,float normal x,y,z,[float vel x,y,z]) - spawns a new point in world/local coordinates, normal is needed when you dont use facecamera, and velocity when you use velocity. You can automaically spawn points with spawnstep. Illegal if typeworldref is used.
--------

--------
{l3dlist:l3dset}
The List3D is organised in l3dsets, every set contains multiple layers. You can render the same set from different l3dviews. One default l3dview always exists per l3dset.		Each l3dset has its own sun. particlesystems and particleclouds are rendered at the end of every l3dset.		Every l3dnode requires a l3dlayerid, directly or indirectly via defaults. l3dsets are independent from each other, and l3dnodes		can only be rendered in one l3dset. By default 0-2 are disabled.<br>		l3dsets are renderd in this order: 0,1,2,3.<br>
@@

%sun%
(l3dlight):(l3dset,[l3dlight]) - returns or sets sun, disabled when 2nd arg is not a l3dlight. If disabled we will use default sun
--------
%default%
([l3dset]):([l3dset])- returns or sets default l3dset.
--------
%getdefaultview%
(l3dview):(l3dset) - returns default l3dview of the set
--------
%updateall%
():(l3dset) - updates all nodes, so that world state is uptodate
--------
%layer%
(l3dlayerid):([l3dset],int 0..15) - returns l3dlayerid for l3dset or default l3dset. If default l3dset is used the layer is also set as default layer. So whenever you dont pass l3dlayerid to l3dnodes, the default layer/l3dset combo will be used.
--------
%disabled%
(boolean):(l3dset,[boolean]) - returns or sets disabled state
--------
%get%
(l3dset):(int 0-3)- returns l3dset
--------

--------
{l3dlist:l3dview}
l3dview is used to render a l3dset. You can specify camera, background and fog for each l3dview.Every l3dset has one default l3dview, which cannot be deleted. Additionally you can register more l3dviews which are processed before the default views.The l3dnodes can be made visible only to certain cameras. By default they are visible to the default camera.<br> Another special purpose of l3dviews is rendering to a texture.
@matobject, @

%fogstart%
([float]):(l3dview,[float]) - returns or sets
--------
%activate%
():(l3dview,l3dset) - activates the l3dview in the given set. Activate inserts the l3dview as first in the list. Has no effect on defaultviews
--------
%rcmdremove%
(boolean success):(l3dview,rcmd,[int occurance]) - removes the rcmd from the list. Occurance value treated as in rcmdadd.
--------
%rcmdflag%
([boolean]):(l3dview,int id,[boolean]) - sets rcmd process bit flag. If rcmdflag of view AND the own flag bitwise return true, then the rcmd will be processed. id = 0..31
--------
%fogcolor%
([float r,g,b,a]):(l3dview,[float r,g,b,a]) - returns or sets
--------
%windowsized%
([boolean]):(l3dview,[boolean]) - returns or sets if the viewport should use the full window size.
--------
%deactivate%
():(l3dview) - deactivates the l3dview. Has no effect on defaultviews
--------
%filldrawlayers%
([boolean]):(l3dview,[boolean]) - enable/disable filling of drawlayers (l3dtrails, l3dmodels, l3dprimitives, l3dtbterrain, l3dlevelmodel, l3dtext, l3dshadowmodel), particlelayers remain active. Default is true. Useful when a pure fx/l2dnode/particle view is being rendered, or layers are organized to be spread over different l3dviews. When set to false the layerstate of previous l3dview remains active (first l3dview of each l3dset always does a clear). That way you can reuse the data, but it only makes sense if camera visibility stays identical. The layer filling is a rather costly operation, so avoid it when possible.
--------
%defaultcamvisflag%
([boolean]):(l3dview,int id,[boolean]) - sets camera visibility bit flag if a default camera is used for this view. It overrides the visflag of the camera itself, however culling is done before and based on the original camera bitid.
--------
%viewsize%
([int width,height]):(l3dview,[int width,height]) - returns or sets the viewport size in pixels. only used when windowsized is false. Warning: viewsize must always be smaller than current window resolution (unless FBO rendering is used).
--------
%rcmdempty%
():(l3dview) - empties the rcmd list of this l3dview.
--------
%new%
(l3dview):() - returns a new l3dview.
--------
%usepolygonoffset%
([boolean]):(l3dview,[boolean]) - returns or sets if depth values are changed depending on slope and constant factors when depth testing occurs.
--------
%delete%
():(l3dview) - deletes the l3dview. Has no effect on defaultviews
--------
%nomultisample%
([boolean]):(l3dview,[boolean]) - returns or sets if multisampling should be deactivated (default off). Only works when window was created with multisample-support. Be warned that drivers may ignore this.
--------
%polygonoffset%
([float scale,bias]):(l3dview,[float scale,bias]) - returns or sets the polygonoffset values..
--------
%fogdensity%
([float]):(l3dview,[float]) - returns or sets
--------
%depthonly%
([boolean]):(l3dview,[boolean]) - returns or sets if a pure Z write should be done.
--------
%rcmdadd%
(boolean success):(l3dview,rcmd,[rcmd ref,int occurance,boolean before]) - adds the rcmd to the rcmd queue list of this l3dview. You can add a maximum of 255 rcmds. They are processed in the order they are added. If there are no commands, the l3dview will do nothing cept debug drawing. As long as rcmd is assigned it won't be garbagecollected.<br><br>You can insert after a another rcmd, which is searched in the list. When occurance is negative we will search the rcmd from the back first. An absolute value of 1 will be first occurance, 2 second and so on. 0 or passing no occurance value is same as +1. If before is true we will insert before the given rcmd (default is false).
--------
%fogend%
([float]):(l3dview,[float]) - returns or sets
--------
%drawcamaxis%
([boolean]):(l3dview,[boolean]) - draws camera orientation
--------
%camera%
(l3dcamera):(l3dview,[l3dcamera]) - returns or sets camera, disabled when 2nd arg is not a camera. If disabled we will use default camera.
--------
%viewpos%
([int x,y]):(l3dview,[int x,y]) - returns or sets the viewport starting position in pixels. 0,0 is bottom left, which is not as in list2d. only used when windowsized is false
--------
%bgskyl3dnode%
([l3dnode]):(l3dview,[l3dnode],[float x,y,z]) - returns or sets l3dnode to be used as background, disabled when 2nd arg is not a l3dnode. Be aware that the l3dnode must not be used anywhere else. It will automatically set the manual world matrix mode. Camera position is scaled using the 3 floats, that way you can 'fix' the model position around camera. Be aware that background models write into max depth, which means that overlapping geometry might create issues.
--------
%fogstate%
([boolean]):(l3dview,[boolean]) - returns or sets
--------
%viewrefbounds%
([float refx,refy,refwidth,refheight]):(l3dview,[float  refx,refy,refwidth,refheight]) - returns or sets the viewport size and position in reference coordinates. only used when windowsized is false. Warning: viewsize must always be smaller than current window refsize.
--------
%bgmatsurface%
([matsurface]):(l3dview,[matsurface]) - returns or sets matsurface, disabled when 2nd arg is not a matsurface
--------
%bgskybox%
([skybox]):(l3dview,[skybox]) - returns or sets skybox, disabled when 2nd arg is not a skybox
--------

--------
{l3dlist:morphcontrol}
To add morph effects between models or meshes.		Morphing is done between vertex normal, position and color info. Activate it on l3dmodels.
@hashid, @

%delete%
():(morphcontrol) - deactivates and deletes the morphcontrol
--------
%modelfrom%
():(morphcontrol,model) - sets model to morph from, if a none-model is passed we will use previous morph results
--------
%newforceall%
(morphcontrol):()- we will always use the vertices in the modeulupdate container.
--------
%activate%
():(morphcontrol,l3dmodel) - activates the morph effect on the given l3dmodel
--------
%deactivate%
():(morphcontrol) - deactivates the morph effect
--------
%factor%
(float):(morphcontrol,float) - sets or returns the blend factor of the morph
--------
%newmeshmorph%
(morphcontrol):()- only a single mesh will get morphed
--------
%meshtarget%
():(morphcontrol,meshid) - sets mesh that will get morphed
--------
%meshto%
():(morphcontrol,meshid) - sets mesh to morph to
--------
%meshfrom%
():(morphcontrol,meshid) - sets mesh to morph from
--------
%newfullmorph%
(morphcontrol):()- all meshes are affected by the morph
--------
%modelto%
():(morphcontrol,model) - sets model to morph to, if a none-model is passed we will use previous morph results
--------

--------
{l3dlist:particle}
A single static particle part of a l3dpgroup
@hashid, @


--------
{l3dlist:skybox}
6 2d images make a cube and can be set as background of a scene.
@hashid, @

%fovfactor%
(float):(skybox,[float size]) - returns or sets fovfactor, renderfov = camera.fov * fovfactor
--------
%delete%
():(skybox) - deletes skybox
--------
%worldrotation%
([float angle,x,y,z]):([float angle,x,y,z]) - sets world angle/axis for skybox cubemap rotations. Also used in shaders when skyreflectmap texgen is used.
--------
%new%
(skybox):(texture cubemap / string north,south,east,west,top,bottom) - creates a new skybox from given texture filenames or uses the given texture (must be cubemap)
--------

--------
{l3dlist:trailpoint}
A point part of a l3dtrail
@hashid, @


--------
{:mathlib}
provides some accelerated functions dealing with vector/matrix math or array operations
@@

%rotdeg2quat%
(float qx,qy,qz,qw):(float ax,ay,az) - converts euler angles (degrees) to quaternion
--------
%quat2rotrad%
(float ax,ay,az):(float qx,qy,qz,qw) - converts quaternion to euler angles (radians)
--------
%quat2rotdeg%
(float ax,ay,az):(float qx,qy,qz,qw) - converts quaternion to euler angles (degrees)
--------
%rotrad2quat%
(float qx,qy,qz,qw):(float ax,ay,az) - converts euler angles (radians) to quaternion
--------
%quatslerp%
(float qx,qy,qz,qw):(float fracc,ax,ay,az,aw,bx,by,bz,bw) - returns quaternion spherical interpolation bettween a and b
--------

--------
{mathlib:matrix16}
4x4 matrices are used for position and rotational transformations. They are saved column-major.
@@

%lookat%
():(matrix16 a, float toX,toY,toZ, upX,upY,upZ, [int axis 0..2]) - sets rotation axis, so that axis (0:x 1:y 2:z default is y) aims at given target pos from current matrix position.
--------
%transform%
(float x,y,z):(matrix16 m,float x,y,z) - transforms the three given coordinates
--------
%affineinvert%
(matrix16 m):(matrix16 m,[matrix16 inv]) - inverts m, or m = invert of inv. Affine invert is faster and more robust than regular invert, but will only work on non-scaled orthogonal matrices.
--------
%scale%
([float x,y,z]):(matrix16 m,[float x,y,z]) - sets/gets scale factors of matrix
--------
%tostring%
(string str):(matrix16 vec) - returns matrix as string
--------
%identity%
(matrix16):(matrix16) - sets diagonal of matrix to 1, rest to 0
--------
%component%
([float]):(matrix16,int index [0..15],[float]) - returns or sets single matrix entry.
--------
%copy%
(matrix16 to):(matrix16 to,matrix16 from) - copys from other to itself
--------
%invert%
(matrix16 m):(matrix16 m,[matrix16 inv]) - inverts m, or m = invert of inv
--------
%new%
(matrix16 m):([table float16]) - constructs identity matrix or uses lua table to fill values. If a table 		with 16 elements is passed, the values are interpreted as a matrix and will 		The OpenGL matrixstyle (column-major) is used so the x,y,z translation is found at element index 12,13,14 (or 13,14,15 as lua arrays start at 		index 1, while C arrays start at index 0)
--------
%rotdeg%
([float x,y,z]):(matrix16 m,[float x,y,z]) - returns or sets rotation in degrees
--------
%transformrotate%
(float x,y,z):(matrix16 m,float x,y,z) - rotate the three given coordinates
--------
%setaxisangle%
():(matrix16 a, float axisX,axisY,axisZ ,rotation) - sets rotation around angle
--------
%rotquat%
([float x,y,z,w]):(matrix16 m,[float x,y,z,w]) - sets/gets rotation as quaternion
--------
%mul%
(matrix16 a):(matrix16 a, b ,[c]) - multiplys: a = b*c or a = a*b. faster but sets W coordinate of each colum to 0, cept last to 1
--------
%rotaxis%
([float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz]):(matrix16 m,[float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz]) - returns or sets rotation axis, make sure they make a orthogonal basis.
--------
%rotrad%
([float x,y,z]):(matrix16 m,[float x,y,z]) - returns or sets rotation in radians
--------
%column%
([float x,y,z,w]):(matrix16 m,int column,[float x,y,z,w]) - sets/gets column (0-3) vector.
--------
%transpose%
(matrix16 m):(matrix16 m,[matrix16 inv]) - transposes m, or m = transpose of inv
--------
%mulfull%
(matrix16 a):(matrix16 a, b ,[c]) - multiplys: a = b*c or a = a*b. accurately takes all 16 values into account.
--------
%pos%
([float x,y,z]):(matrix16 m,[float x,y,z]) - sets/gets position of matrix
--------

--------
{mathlib:staticarray}
Staticarrays are created as plain C arrays within luxinia and cannot be resized. They can be used for operations that require lot's of calculations or are used by other C functions.
@hashid, @

%clamp%
():(staticarray self, value min, value max) - self = (self with values clamped to min,max)
--------
%resize%
():(staticarray self, int size) - Changes size of array.
--------
%count%
(int):(staticarray) - returns maximum number of floatelements
--------
%index%
([value]):(staticarray,index,[value]) - assigns index the float value if given or simply returns the value at the index. Returns error in case of invalid indices.
--------

--------
{staticarray:floatarray}
Floatarray in Luxinia for array operations.
@@

%v3%
([float x,y,z]):(floatarray,int index, [float x,y,z]) - returns or sets ith vector3, make sure count is 3*maxindex.
--------
%v3all%
():(floatarray,float x,y,z,[int startfloat, vectorcount, stride]) - returns or sets all values of the floatarray, optionally can set from which float to start and how many vectors. Vectorsize is 3+stride.
--------
%v4%
([float x,y,z,w]):(floatarray,int index, [float x,y,z,w]) - returns or sets ith vector4, make sure count is 4*maxindex.
--------
%v3lerp%
():(floatarray interpolated(3i), floatarray splinepos(3n),[int noverride]) - does linear interpolation based on the n vectors (eventimed), and interpolates using i steps.
--------
%new%
(floatarray):(int count) - creates a new staticarray. Count must be >0.
--------
%sub%
():(floatarray self,floatarray / value a, [floatarray b]) - self-=a or self = a - b
--------
%set%
():(floatarray self,floatarray / value a) - self = a (copy an array or set value to all)
--------
%max%
():(floatarray self,floatarray / value a, [floatarray b]) - self = max(self,a) or self = max(a,b)
--------
%v4lit%
():(floatarray outputintensities(4n), floatarray vertexpos(3n), floatarray vertexnormal(3n), float lightpos x,y,z ,float diffuse r,g,b ,float ambient r,g,b ,float attconst, float attlin, float attsq) - computes per vertex lighting intensities for n vertices into the given array. The given light position, attenuation and color values are used. Note that light position must be in same coordinate system as vertices (local).
--------
%div%
():(floatarray self,floatarray / value a, [floatarray b]) - self/=a or self = a / b
--------
%v3tonext%
():(floatarray out(3n)) - for every vector we do (next-self)
--------
%mul%
():(floatarray self,floatarray / value a, [floatarray b]) - self*=a or self = a * b
--------
%v4lerp%
():(floatarray interpolated(4i), floatarray splinepos(4n),[int noverride]) - 		does linear interpolation based on the n vectors (eventimed), and interpolates using i steps.
--------
%min%
():(floatarray self,floatarray / value a, [floatarray b]) - self = min(self,a) or self = min(a,b)
--------
%lerp%
():(floatarray interpolated(i), floatarray splinepos(n),[int noverride]) - does linear interpolation based on the n floats (eventimed), and interpolates using i steps.
--------
%v4all%
():(floatarray,float x,y,z,w,[int startfloat, vectorcount, stride]) - returns or sets all values of the floatarray, optionally can set from which float to start and how many vectors. Vectorsize is 4+stride.
--------
%v3spline%
():(floatarray interpolated(3i), floatarray splinepos(3n),[int noverride]) - does spline interpolation based on the n splinepos vectors (eventimed), and interpolates using i steps.
--------
%add%
():(floatarray self,floatarray / value a, [floatarray b]) - self+=a or self = a + b
--------

--------
{staticarray:intarray}
Intarray in Luxinia for array operations.
@@

%sub%
():(intarray self,intarray / value a, [intarray b]) - self-=a or self = a - b
--------
%mul%
():(intarray self,intarray / value a, [intarray b]) - self*=a or self = a * b
--------
%min%
():(intarray self,intarray / value a, [intarray b]) - self = min(self,a) or self = min(a,b)
--------
%set%
():(intarray self,intarray / value a) - self = a (copy an array or set value to all)
--------
%max%
():(intarray self,intarray / value a, [intarray b]) - self = max(self,a) or self = max(a,b)
--------
%div%
():(intarray self,intarray / value a, [intarray b]) - self/=a or self = a / b
--------
%add%
():(intarray self,intarray / value a, [intarray b]) - self+=a or self = a + b
--------
%new%
(intarray):(int count) - creates a new staticarray. Count must be >0.
--------

--------
{staticarray:ubytearray}
Unsigned byte array in Luxinia for array operations.
@@

%sub%
():(ubytearray self,ubytearray / value a, [ubytearray b]) - self-=a or self = a - b
--------
%set%
():(ubytearray self,ubytearray / value a) - self = a (copy an array or set value to all)
--------
%max%
():(ubytearray self,ubytearray / value a, [ubytearray b]) - self = max(self,a) or self = max(a,b)
--------
%div%
():(ubytearray self,ubytearray / value a, [ubytearray b]) - self/=a or self = a / b
--------
%min%
():(ubytearray self,ubytearray / value a, [ubytearray b]) - self = min(self,a) or self = min(a,b)
--------
%mul%
():(ubytearray self,ubytearray / value a, [ubytearray b]) - self*=a or self = a * b
--------
%vector4%
([int x,y,z,w]):(ubytearray,int index, [int x,y,z,w]) - returns or sets ith vector4, make sure count is 4*maxindex.
--------
%vector3%
([int x,y,z]):(ubytearray,int index, [int x,y,z]) - returns or sets ith vector3, make sure count is 3*maxindex.
--------
%vector3all%
():(ubytearray,int x,y,z,[int startubyte, vectorcount, stride]) - returns or sets all values of the ubytearray, optionally can set from which int to start and how many vectors. Vectorsize is 3+stride.
--------
%add%
():(ubytearray self,ubytearray / value a, [ubytearray b]) - self+=a or self = a + b
--------
%new%
(ubytearray):(int count) - creates a new staticarray. Count must be >0.
--------

--------
{:ode}
Physical simulation using the ODE Lib.Use its childclasses for simulating physical behaviour of objects (@see http://www.ode.org). Read the ODE API documentation for better understanding, parts of it are included in this documentation. The luxinia API is simplifies some calls or renames them, but basicly, the functions are the same.
A physical simulation can be divided in two object types: Static and dynamic objects. In ode, simulated objects that are staticly are called geoms, and objects that can interact and move dynamicly are called bodies. Geoms are solid (except trimeshes, which is the source of most problems when using them) objects, socalled primitives - cubes, spheres, cylinders and so on. Bodies are built using multiple geoms, allowing more complex objects for your simulation. The collision detection is done by using socalled spaces.
@@


--------
{ode:dgeom}
Geoms are solid objects that can collide with other geoms.
@hashid, @

%rotrad%
([float x,y,z]) : (dgeom geom,[float x,y,z]) - sets/gets rotation of geom. The angles must be calculated from a matrix, so the results can differ from what you set. These matrix calculations are quite expensive, so use it with care. This functions uses x,y,z as angles in radians (180°==PI)
--------
%local2world%
(float x,y,z) : (dgeom geom,float x,y,z) - transforms the given coordinates with the matrix of the geom, as if x,y,z are local coordinates of the geom and world coordinates are returned.
--------
%fdirnormal%
([float x,y,z]) : (dgeom geom,[float x,y,z]) - sets/gets normal vector to the friction direction vector that defines a direction along which frictional force is applied. The friction direction vector is computed as the crossproduct of the contactnormal and the normal vector that is defined here.
--------
%setcategory%
([int]):(dgeom,int set {0,1}) - sets/gets raw category bits as number
--------
%disabledspace%
([dspace]) : (dgeom geom,[dspace]) - The disabledspace is the space a geom is put into if it has a body that is disabled. This is usefull if you have a large amount of bodies that should collide with each other but that are disabled most of the time.
--------
%maxcontacts%
([int]) : (dgeom geom,[int]) - sets/gets maximum number of contacts for this geom. If two geoms are tested for collision, multiple contacts can be generated for this case. If a geom has a limited number of possible contacts (set <=0 for deactivation of maximum), the minimum of maxcontacts of both geoms is chosen. Reducing the number of contacts max boost up the simulation, but can cause jittering of bodies, making autodisabling useless. Defaultvalue is 0 (no limit), but the general limit of contacts per geom is 128. The effect depends on the geom type. For example, two colliding spheres will never generate more than one contact, while two colliding boxes can generate not more than 4 contacts. Only if a geom collides with a complex trimesh, the limit can be exceeded.
--------
%maxcontactinfo%
([int]) : (dgeom geom, [int]) - sets/gets the maximum number of generated contact info. The contactinfo is a structure that stores the coordinates, the normal and the depth of a contact. This is normaly also stored in a contactjoint that is generated from a contact. However, if you want to create a geom that only works as a sensor for collision (i.e. if a door should open if someone stands in front of it), and turn nocontactgeneration on, you can retrieve contactinformation from such geoms.
--------
%testtriarray%
(int count,table geomi,table tristart,table triall]):(dgeom a, dgeom b, int maxcount) -tests two geoms for intersecting triangles. Only works if triarrayresult is activated for the included trimeshgeoms. Each collision pair results into trigeom/geom pair in geomi table. Associated with startindex/numberoftris pair tristart. Startindex maps as offset index into triall, which then has numberoftris*3 int indices.
--------
%testnear%
(int count,table geomi]):(dgeom a, dgeom b, int maxcount) -tests two geoms if they are near each other (aaboxes overlap).
--------
%transformer%
([dgeomtransform]):(dgeom) - returns the geomtransform that transforms the geom or returns nothing if the geom is not transformed. Note that you might get the 'final' geom in the transformhierarchy if you get a collision feedback, what may not be what you want / need.
--------
%fdirpriority%
([float]) : (dgeom geom,[float]) - sets/gets priority of the fdirnormal. The priority can be used in different ways.
--------
%rotdeg%
([float x,y,z]) : (dgeom geom,[float x,y,z]) - sets/gets rotation of geom. The angles must be calculated from a matrix, so the results can differ from what you set. These matrix calculations are quite expensive, so use it with care. This function uses x,y,z as angles in degrees (180°==PI).
--------
%matrix%
([matrix16]) : (dgeom geom,[matrix16]) - sets/gets matrix of geom
--------
%enabledspace%
([dspace]) : (dgeom geom,[dspace]) - The enabledspace is the space a geom is put into if it has no body or if its body is enabled. This is usefull if you have a large amount of bodies that should collide with each other but that are disabled most of the time.
--------
%world2local%
(float x,y,z) : (dgeom geom,float x,y,z) - transforms the given coordinates from world coordinates into local coordinates of the geom.
--------
%category%
([boolean]):(dgeom,int set {0-1}, int bit {0-31}, [boolean on]) - Sets ODE's collide and category bits. A geom can gollidewith other geoms if cat1&col2 or cat2&col1 are not zero.

ODE uses collide and categorybits to reject geoms for collision. They can be used to prevent collision between certain geoms. A collision is rejected if both the bitset 1 of geom A doesn't have bits in common with the bitset 2 of geom B, and if the bitset 2 of geom A doesn't have bits in common with bitset 1 of geom B.
--------
%getcontactinfo%
(int / float x,y,z, nx,ny,nz, depth, dgeom othergeom):(dgeom geom, [int index])If contacts have been generated in your simulation and you have set the maxcontactinfo value for this geom to a value>0, a collision generation that creates contacts will also store the contact results in the contactinfo of the geom. You can read out the values for contact generation with this function. If no index is given as argument, the number of stored contactinformation are returned for this geom. If an index is passed, the contactinformation for this index is returned. The index must be >=0 and <contactcount in order to return valid values. The returned values are the position, the normalvector and the depth (distance) of the penetraction.
--------
%surfaceid%
([int]):(dgeom,[int]) - sets/gets surfaceid of geom (0-255). If two geoms generate a contact, the surfaceproperties must be specified. These properties can be rather complicated and may depend from the type of the surface (rubber on glas won't slide, wood on glas slides, both slides on ice, but both don't slide at each other very well, etc.). In order to give you as much control as possible, yet keeping it as simple as possible, you can specify every surfacecombination that you wish by defining a list of contactparameters and defining the surface to be used by a combination of surfaceids.
--------
%rotquat%
([float x,y,z,w]) : (dgeom geom,[float x,y,z,w]) - sets/gets 					 rotation of geom as quaternion.
--------
%body%
(dbody body) : (dgeom geom, [dbody body/other]) - sets/gets the geom - if 2nd arg is not a dbody, it removes the geom from the body. The geom must not be transformed if a body is set. If the geom is transformed and the body is requested, the function will look look up the body of the transformer in a loop.
--------
%motion2%
([float]) : (dgeom geom,[float]) - sets/gets motion values of surface. This means that the contact will look like in motion for other objects that are in contact with this geom. Behavior is undefined if the fdirmixing is set to priority or average.
--------
%motion1%
([float]) : (dgeom geom,[float]) - sets/gets motion values of surface. This means that the contact will look like in motion for other objects that are in contact with this geom. Behavior is undefined if the fdirmixing is set to priority or average.
--------
%delete%
() : (dgeom geom) - deletes a geom
--------
%test%
(int count,[table pos, table normal, table depth, table geom, table tri]):(dgeom,dgeom, [string whichresults]) - tests two geoms against each other and returns the number of contacts, the position coordinates as a floatarray (x,y,z,...), the normals as a floatarray, the depth as a floatarray (d1,d2,...), the contactgeoms as a table and triangle data as floatarry (index,u,v,...).

The whichresults string describes which kind of results are returned. Each characterstands for a tableresult where the characters are:

* 'p': positional arrayinformation
* 'n': collision normals
* 'd': depth information
* 'g': geom information
* 't': triangle information

If no string is passed, the returned values are as shown above, otherwise the appropriate arrays are returned in the given order specified by the passed string. If the string contains other characters, an error is thrown. Triangle information is only accurate when testing with rays and raytrisresult-enabled dgeomtrimeshes, else the triangle index is -1
--------
%nocontactgenerator%
([boolean]) : (dgeom geom, [boolean]) - sets/gets if contacts should be generated for this geom. You might want to deactivate contactgeneration for geoms that only should act as sensors in your physical environment.
--------
%rotaxis%
([float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz]) : (dgeom geom,[float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz])) - returns or sets local rotation axis, make sure they make a orthogonal basis.
--------
%pos%
([float x,y,z]) : (dgeom geom,[float x,y,z]) - sets/gets position of geom
--------

--------
{dgeom:dbody}
A rigid body has various properties from the point of view of the simulation. Some properties change over time:
* Position vector (x,y,z) of the body's point of reference. Currently the point of reference must correspond to the body's center of mass.
* Linear velocity of the point of reference, a vector (vx,vy,vz).
* Orientation of a body, represented by a quaternion (qs,qx,qy,qz) or a 3x3 rotation matrix.
* Angular velocity vector (wx,wy,wz) which describes how the orientation changes over time.
Other body properties are usually constant over time:
* Mass of the body.
* Position of the center of mass with respect to the point of reference. In the currentimplementation the center of mass and the point of reference must coincide.
* Inertia matrix. This is a 3x3 matrix that describes how the body's mass is distributed around the center of mass. 
@@

%addrelforce%
() : ([float fx,fy,fz],[float x,y,z],[rel]) - adds force to the body in the body's orientation. If coordinates are given, the force is added at this point, which will add some force at the torque. If a 7th parameter (boolean) is given, the point is in relative coordinates.
--------
%angvel%
([float vx,vy,vz]) : (dbody self,[float fx,fy,fz]) - sets/gets angular velocity of the body
--------
%rotdrag%
([float x,y,z]):(body,[float x,y,z]) - this vector is multiplied with the 		angular velocity vector of the body each step. Don't set the vector to values >1 or <0, 		otherwise your body will either flicker around or accelerate to infinity. This is 		a useful value to let the system lose energy which is stabilizing the simulation quite well.
--------
%gravity%
([boolean on]) : ([boolean on]) - sets/gets if gravity is on for this body
--------
%massadjust%
():(dbody self, float newmass) - sets new mass
--------
%massaddbox%
():(dbody self,float density,lx,ly,lz,[any total]) - adds mass of a box. If a 6th argument is passed, the density is calculated to total mass
--------
%minenableforce%
([float f]) : (dbody self,[float f]) - sets/gets the required force to enable the body (default=0).
--------
%force%
([float x,y,z]) : () - sets gets power of force
--------
%reaffect%
([int reaffect]):(dbody,[int reaffect]) - sets/gets body reaffection. If two bodies collide and at least one affect bit of the other body is set that is set in reaffect, the body is affected by the other body.
--------
%jointenergy%
(float kineticenergy):(dbody,[float multiplier]) - returns the kineticenergy applied to the body by connected bodies. Since the sum can become too small, an additional multiplier can be applied.
--------
%massparam%
([float mass,cx,cy,cz, i11,i22,i33,i12,i13,i23]):(dbody self,[float mass,cx,cy,cz, i11,i22,i33,i12,i13,i23]) - sets/gets massproperties of the body. Refer to the ode docs here, this function is for advanced people who know what they want.
--------
%disablesteps%
([int]) : ([int]) - trace depth when an enabled body touches a group of disabled bodies.

--------
%actdepth%
(int) : (dbody self) - returns -1 if it was activated by a body that has a minactdepth >= 0
--------
%finitemode%
([boolean on,float x,y,z]):([boolean on],[float x,y,z]) - Sets/gets mode and axis of the finite rotation
The mode controls the way a body's orientation is updated at each time step. 
* true: An 'infinitesimal' orientation update is used. This is fast to compute, but it can occasionally cause inaccuracies for bodies that are rotating at high speed, especially when those bodies are joined to other bodies. This is the default for every new body that is created.
* false: A 'finite' orientation update is used. This is more costly to compute, but will be more accurate for high speed rotations. Note however that high speed rotations can result in many types of error in a simulation, and this mode will only fix one of those sources of error.
The three floats set the finite rotation axis for a body. This is axis only has meaning when the finite rotation mode is set.
If this axis is zero (0,0,0), full finite rotations are performed on the body.If this axis is nonzero, the body is rotated by performing a partial finite rotation along the axis direction followed by an infinitesimal rotation along an orthogonal direction.
This can be useful to alleviate certain sources of error caused by quickly spinning bodies. For example, if a car wheel is rotating at high speed you can call this function with the wheel's hinge axis as the argument to try and improve its behavior. 
--------
%state%
([boolean]) : ([boolean enable]) - returns true if the body is enabled. Disables/Enables body if boolean value is passed. Disabled bodies don't use CPU power.
--------
%world2local%
(float x,y,z):(dbody,float x,y,z) - converts world to local coordinates
--------
%worldpointvel%
(float x,y,z):(dbody,float x,y,z) - retrieve velocity at world point x,y,z
--------
%localpointvel%
(float x,y,z):(dbody,float x,y,z) - retrieve velocity at relative point x,y,z
--------
%massaddsphere%
():(dbody self, float density,radius,[any total]) - adds the mass to the mass of a sphere with density and radius. If a third argument is applied, the density will be calculated to the total mass of the sphere.
--------
%local2world%
(float x,y,z):(dbody,float x,y,z) - converts local to world coordinates
--------
%veldrag%
([float x,y,z]):(body,[float x,y,z]) - this vector is multiplied with the 		velocity vector of the body each step. Don't set the vector to values >1 or <0, 		otherwise your body will either flicker around or accelerate to infinity. This is 		a useful value to let the system lose energy which is stabilizing the simulation quite well.
--------
%masscappedcyl%
():(dbody self, float density,int axis, float radius,length, [any total]) - sets mass of a cappedcylinder with density, radius and length. The axis indicates the orientation of the cylinder: 1=x, 2=y, 3=z. A capped cylinder is a cylinder that has spheres at its end.
--------
%lock%
([int axis,float value,planewidth,planeveldamp]):(dbody,[int axis,float value],[planewidth],[planeveldamp]) - sets/gets locking for body. One axis can be set to be locked at a certain value. x=1,y=2,z=3,0=no locking. Planewidth is the width in which the body can move. Planeveldamp is the damping applied to the velocity in the locking axis. The damping should be >=0 and <=1. Default values are for unused arguments is 0.
--------
%addforce%
() : ([float fx,fy,fz],[float x,y,z],[rel]) - adds force to the body. If coordinates are given, the force is added at this point, which will add some force at the torque. If a 7th parameter (boolean) is given, the point is in relative coordinates.
--------
%velthreshold%
([float]) : ([float]) - when the velocity drops below this value, the body becomes autodisabled.
--------
%connected%
(boolean):(dbody,dbody) - true if both bodies are connected through a joint
--------
%nextminenableforce%
([float f]) : (dbody self,[float f]) - sets/gets the required force to enable the body (default=0), once it was activated - it overwrites the minenableforce then. This is usefull if you have a brickwall and the bricks need lot's of force to be loosed. But once loosed, it shouldn't need much effort anymore to reenable them.
--------
%vectorfromworld%
(float x,y,z):(dbody,float x,y,z) - converts world rotation into local
--------
%jointforces%
(float fx,fy,fz,forcesumlength,forcelengthsum):(dbody) - returns the sum of all force vectors that is contributed by all joints that are attached to the body, the total length of the forcevector and the sum of all lengths of forces together. Note that the sum of all lengths is never 0 if a force is applied, while all other values can be 0.
--------
%vectortoworld%
(float x,y,z):(dbody,float x,y,z) - rotate a vector into world coordinates
--------
%masszero%
():() - sets mass of body to zero
--------
%massaddcylinder%
():(dbody self, float density,int axis, float radius,length, [any total]) - adds mass of a cylinder with density, radius and length. The axis indicates the orientation of the cylinder: 1=x, 2=y, 3=z.
--------
%jointcount%
(int):(dbody) - the number of joints that the body is connected to.
--------
%joint%
([djoint]):(dbody,int i) - returns the i-th joint the body is connected to.
--------
%defaults%
() : (dbody) - resets the autodisable properties to the settings of the world.
--------
%velocity%
([float vx,vy,vz]) : (dbody self,[float fx,fy,fz]) - sets/gets linear velocity of the body
--------
%new%
(dbody) : () - creates a new body
--------
%torque%
([float x,y,z]) : ([float x,y,z]) - sets/gets power of torque force
--------
%addtorque%
() : ([float fx,fy,fz]) - adds torque force to the body
--------
%massrotate%
():(dbody self, float x,y,z) - rotates (radians) the mass of the body.
--------
%angularthreshold%
([float]) : ([float]) - rotational minimum limit when the body should become disabled.
--------
%masscylinder%
():(dbody self, float density,int axis, float radius,length, [any total]) - sets mass of a cylinder with density, radius and length. The axis indicates the orientation of the cylinder: 1=x, 2=y, 3=z.
--------
%affect%
([int affect]):(dbody,[int affect]) - sets/gets body affection. If two bodies collide and at least one reaffect bit of the other body is set that is set in affect, the other body is affected by the body.
--------
%disabletime%
([float]) : ([float]) - amount of time to be waited until the body becomes autodisabled.
--------
%masssphere%
():(dbody self, float density,radius,[any total]) - sets the mass to the mass of a sphere with density and radius. If a third argument is applied, the density will be calculated to the total mass of the sphere.
--------
%autodisable%
([boolean]) : ([boolean on]) - if true, the body can become disabled if it doesn't do much. This will speed up the simulation alot if you have lot's of objects that are just lieing around.
--------
%massbox%
():(dbody self,float density,lx,ly,lz,[any total]) - sets mass of a box. If a 6th argument is passed, the density is calculated to total mass
--------
%minactdepth%
([int]) : (dbody self,[int]) - sets/gets minimum activation depth, if ==-1 => disabled (default). Use this to reduce the number of activated bodys outgoing from a activator source.
--------
%lockrotaxis%
([int axis,float x,y,z]):(dbody,[int axis,float x,y,z]) - sets/gets locking rotation axis for body. Chose the axis with the axis number (x=1,y=2,z=3,0=no lock) and set the direction where this axis should look to. 
--------
%addreltorque%
() : ([float fx,fy,fz]) - adds torque force to the body in the body's orientation
--------
%massaddcappedcyl%
():(dbody self, float density,int axis, float radius,length, [any total]) - adds mass of a cappedcylinder with density, radius and length. The axis indicates the orientation of the cylinder: 1=x, 2=y, 3=z. A capped cylinder is a cylinder that has spheres at its end.
--------
%masstranslate%
():(dbody self,float x,y,z) - translates the mass.
--------
%nocollissionwithconnected%
([boolean on]) : ([boolean on]) - sets/gets boolean, default=true. If it is true for two bodies that are connected, the collissioncheck is rejected if the two bodies of the collission are connected by a joint, before the complex collissioncheck is done - so it saves performance. If only one of the bodies has this flag set, it will be not affected by the other body. If the flag is false for both of them, they will collide normally with each other.
--------

--------
{dgeom:dgeombox}
A solid box object.
@@

%size%
([float x,y,z]):(dgeombox,[float x,y,z]) - sets/gets size of the box
--------
%new%
(dgeombox box) : ([float w,h,l],[dspace space]) - creates a box with width=w, height=h and length=l
--------

--------
{dgeom:dgeomccylinder}
A capped cylinder is like a normal cylinder except it has half-sphere caps at its ends. This feature makes the internal collision detection code particularly fast and accurate. The cylinder's length, not counting the caps, is given by length. The cylinder is aligned along the geom's local Z axis. The radius of the caps, and of the cylinder itself, is given by radius.
@@

%radius%
([float]):(dgeomccylinder,[float]) - sets/gets the radius of the dgeomccylinder
--------
%length%
([float]):(dgeomccylinder,[float]) - sets/gets the length of the dgeomccylinder
--------
%lenrad%
([float rad,float len]):(dgeomccylinder,[float rad, float len]) - sets/gets the radius and length of the dgeomccylinder
--------
%new%
(dgeomccylinder) : ([float r,l],[dspace space]) - Create a capped cylinder geom of the given parameters, and return its ID. If space is nonzero, insert it into that space.
--------

--------
{dgeom:dgeomcylinder}
Flatended cylinder. The cylinder is in the unstable branch of ODE. It doesn't collide with other cylinders or planes. It also seems to react unstable in certain positions.
@@

%radius%
([float]):(dgeomccylinder,[float]) - sets/gets the radius of the dgeomccylinder
--------
%length%
([float]):(dgeomccylinder,[float]) - sets/gets the length of the dgeomccylinder
--------
%lenrad%
([float rad,float len]):(dgeomccylinder,[float rad, float len]) - sets/gets the radius and length of the dgeomccylinder
--------
%new%
(dgeomcylinder) : (float radius,length) - creates a flatended cylinder
--------

--------
{dgeom:dgeomplane}
Planes are infinite and so non-placeable geoms. This means that, unlike placeable geoms, planes do not have an assigned position and rotation. This means that the parameters (a,b,c,d) are always in world coordinates. In other words it is assumed that the plane is always part of the static environment and not tied to any movable object.
@@

%normal%
([float x,y,z]):(dgeomplane,[float x,y,z]) - sets the normal vector of the plane. Luxinia normalizes this vector automaticly for you.
--------
%distance%
([float d]):(dgeomplane,[float d]) - sets the distance of the plane to the origin (0,0,0)
--------
%new%
(dgeomplane) : ([float a,b,c,d],[dspace]) - Create a plane geom of the given parameters, and return its ID. If space is given, insert it into that space. The plane equation is a*x+b*y+c*z = d 
The plane's normal vector is (a,b,c), is normalized automaticly. 
--------

--------
{dgeom:dgeomray}
A ray is different from all the other geom classes in that it does not represent a solid object. It is an infinitely thin line that starts from the geom's position and extends in the direction of the geom's local Z-axis.
Calling dCollide between a ray and another geom will result in at most one contact point. Rays have their own conventions for the contact information in the dContactGeom structure (thus it is not useful to create contact joints from this information):
* pos - This is the point at which the ray intersects the surface of the other geom, regardless of whether the ray starts from inside or outside the geom.
* normal - This is the surface normal of the other geom at the contact point. if dCollide is passed the ray as its first geom then the normal will be oriented correctly for ray reflection from that surface (otherwise it will have the opposite sign).
* depth - This is the distance from the start of the ray to the contact point. 
Rays are useful for things like visibility testing, determining the path of projectiles 
or light rays, and for object placement.
@@

%get%
(float x,y,z, dx,dy,dz):(dgeomray) - returns position and normalized direction of the ray
--------
%length%
([float len]):(dgeomray,[float len]) - sets/gets length of ray
--------
%set%
():(dgeomray,float x,y,z, dx,dy,dz) - set position and direction of ray in space. The length of the ray will NOT be changed by using this function.
--------
%new%
(dgeomray) : ([float length],[dspace]) - Create a ray geom of the given length, and return its ID. If space is given, insert it into that space.
--------

--------
{dgeom:dgeomsphere}
A sphere with a radius, the fastest and most simple collission solid.
@@

%r%
([float r]) : (dgeomsphere sphere,[float r]) - sets/gets radius of sphere
--------
%new%
(dgeomsphere sphere) : ([float r],[dspace space]) - creates a new sphere with radius r. Inserts the sphere in space, if given
--------

--------
{dgeom:dgeomtransform}
A geometry transform `T' is a geom that encapsulates another geom `E', allowing E to be positioned and rotated arbitrarily with respect to its point of reference.
Most placeable geoms (like the sphere and box) have their point of reference corresponding to their center of mass, allowing them to be easily connected to dynamics objects. Transform objects give you more flexibility - for example, you can offset the center of a sphere, or rotate a cylinder so that its axis is something other than the default.
T mimics the object E that it encapsulates: T is inserted into a space and attached to a body as though it was E. E itself must not be inserted into a space or attached to a body. E's position and rotation are set to constant values that say how it is transformed relative to T. If E's position and rotation are left at their default values, T will behave exactly like E would have if you had used it directly.
@@

%geom%
([dgeom]) : (dgeomtranform self, [dgeom]) - sets/gets the geom to be transformed. The passed geom must not be inserted in a space or must not be transformed.
--------
%new%
(dgeomtranform) : ([dspace space]) - creates a new transformobject
--------

--------
{dgeom:dgeomtrimesh}
Triangle mesh collision.
@@

%raytrisresult%
([boolean]):(dgeomtrimesh,[boolean]) - You can get precise ray test results, such as index of which triangle was hit and which barycentric coordinates the hitpoint had.
--------
%triarrayresult%
([boolean]):(dgeomtrimesh,[boolean]) - You can get all intersecting triangles with the geoms when using triarraycollide command. Outside of calling that function you should disable manually, else there will be a slight slowdown.
--------
%new%
(dgeomtrimesh):(dgeomtrimeshdata,[dspace space]) - creates a trimesh geom, ready for collision.
--------

--------
{dgeom:dgeomtrimeshdata}
Trimesh data that is used for dgeomtrimesh. You can instantiate one trimeshdata and reuse it multiple times.
@@

%new%
(dgeomtrimeshdata):(table intindices,table vectors) - Creates a trimeshdataset.
--------

--------
{dgeom:dspace}
Spaces are grouping geoms and are doing the collisiondetection on the geoms inside of them. You can insert space into spaces, which should be done for performance reasons. For example, you may want to create a space that does not test it's geoms inside with each other, while it should create with the rest of the environment.
@@

%geomcount%
(int count) : (dspace space) - Return the number of geoms contained within a space.
--------
%delete%
() : (dspace space,[boolean cleanup]) - destroys a space. If cleanup is true it will delete the geoms that are in the space.
--------
%query%
(boolean isin) : (pscape space, dgeom geom) - returns true if the geom is in the space
--------
%collidetest%
([int]) : (dspace space,[int]) - if collidetest is true, the space's objects are tested against each other. It is usefull to create a 'static' space without collidetest that contains no bodies and inserting this space into a 'dynamic' space that contains bodies. That way, a lot of collisiontesting can be avoided and the simulation runs faster.
--------
%remove%
() : (dspace space, dgeom geom) - removes the geom from the space
--------
%add%
() : (dspace space, dgeom geom) - adds a geom to the space
--------
%get%
([dgeom]) : (dspace space, int i) - Return the i'th geom contained within the space. i must range from 0 to dSpaceGetNumGeoms()-1.
If any change is made to the space (including adding and deleting geoms) then no guarantee can be made about how the index number of any particular geom will change. Thus no space changes should be made while enumerating the geoms.
This function is guaranteed to be fastest when the geoms are accessed in the order 0,1,2,etc.Other non-sequential orders may result in slower access, depending on the internal implementation.
--------

--------
{dspace:dspacehash}
Multi-resolution hash table space. This uses an internal data structure that records how each geom overlaps cells in one of several three dimensional grids. Each grid has cubical cells of side lengths 2^i, where i  is an integer that ranges from a minimum to a maximum value. The time required to do intersection testing for n objects is O(n) (as long as those objects are not clustered together too closely), as each object can be quickly paired with the objects around it.
@@

%new%
(dspacehash) : ([dspace space]) - creates a hashspace, if space is given, the new space is inserted in the given space
--------

--------
{dspace:dspacequad}
The quadtree is suited for collision that is mostly planar. However the use of this class is not recommend.
@@

%new%
(dspacequad) : ([dspace space],[float cx,cy,cz, float w,h,d, int depth]) - Creates a quadtree space. center and extents define the size of the root block. depth sets the depth of the tree - the number of blocks that are created is 4^depth
--------

--------
{dspace:dspacesimple}
Simple space. This does not do any collision culling - it simply checks every possible pair of geoms for intersection, and reports the pairs whose AABBs overlap. The time required to do intersection testing for n objects is O(n2). This should not be used for large numbers of objects, but it can be the preferred algorithm for a small number of objects. This is also useful for debugging potential problems with the collision system.
@@

%new%
(dspacesimple) : ([dspace space]) - creates a simple space if space is given, the new space is inserted in the given space
--------

--------
{dgeom:dterrain}
Square sized terrain geom, represented by a heightfield.
@@

%new%
(dgeomterrain) : (int width,height,float level, boolean yisup, boolean finite, boolean placeable) - Creates a terrain with width and height, with iniatial levelheight. The current terrain is square anyway and needs to be power of 2, but this may change sometime, at least that it must be square.
--------

--------
{ode:djoint}
Joints are connecting bodies. They simulate contacts, varius hinges and slider joints. For example if a chair stands on the floor, each of his foots are connected with a djointcontact to the floor or if a car steers with the wheels, ODE uses a jointhinge2 to simulate this. Ragdoll physics is also a typical example.
@hashid, @

%cfm2%
([float]):(djoint,[float]) - same as cfm but for the 2nd axis (if exists)
--------
%stoperp3%
([float]):(djoint,[float]) - same as stoperp
--------
%geom1%
([dgeom]):(djoint) - returns geom1 of the joint it has collided with
--------
%fmax3%
([float]):(djoint,[float]) - same as fmax but for axis 3
--------
%stoperp2%
([float]):(djoint,[float]) - same as stoperp
--------
%lostop2%
([float]):(djoint,[float]) - same as lostop but for the 2nd axis (if exists)
--------
%fudgefactor3%
([float]):(djoint,[float]) - same as fudgefactor but for axis 3
--------
%lostop%
([float]):(djoint,[float]) - Low stop angle or position. Setting this to -dInfinity (the default value) turns off the low stop. For rotational joints, this stop must be greater than - pi to be effective.
--------
%velocity2%
([float]):(djoint,[float]) - Desired motor velocity axis 2
--------
%feedback%
([float xf1,yf1,zf1, xt1,yt1,zt1, xf2,yf2,zf2, xt2,yt2,zt2):(djoint) - returns force and torque applied to the connected bodies of the joint. Since some joints must not be connected to two bodies, either the force and torque of body1 or body2 may not be valid. 
--------
%fudgefactor%
([float]):(djoint,[float]) - The current joint stop/motor implementation has a small problem: when the joint is at one stop and the motor is set to move it away from the stop, too much force may be applied for one time step, causing a 'jumping' motion. This fudge factor is used to scale this excess force. It should have a value between zero and one (the default value). If the jumping motion is too visible in a joint, the value can be reduced. Making this value too small can prevent the motor from being able to move the joint away from a stop.
--------
%stopcfm2%
([float]):(djoint,[float]) - same as stopcfm
--------
%stopcfm%
([float]):(djoint,[float]) - The constraint force mixing (CFM) value used by the stops. Together with the ERP value this can be used to get spongy or soft stops. Note that this is intended for unpowered joints, it does not really work as expected when a powered joint reaches its limit.
--------
%velocity3%
([float]):(djoint,[float]) - Desired motor velocity axis 3
--------
%fudgefactor2%
([float]):(djoint,[float]) - same as fudgefactor but for axis 2
--------
%histop2%
([float]):(djoint,[float]) - same as histop but for the 2nd axis (if exists)
--------
%velocity%
([float]):(djoint,[float]) - Desired motor velocity axis 1(this will be an angular or linear velocity).
--------
%bounce%
([float]):(djoint,[float]) - The bouncyness of the stops. This is a restitution parameter in the range 0..1. 0 means the stops are not bouncy at all, 1 means maximum bouncyness.
--------
%fmax%
([float]):(djoint,[float]) - The maximum force or torque that the motor will use to achieve the desired velocity. This must always be greater than or equal to zero. Setting this to zero (the default value) turns off the motor.
--------
%cfm3%
([float]):(djoint,[float]) - same as cfm but for the 3rd axis (if exists)
--------
%body1%
([dbody]):(djoint) - returns body1 of the joint or nil if not connected
--------
%histop3%
([float]):(djoint,[float]) - same as histop but for the 3rd axis (if exists)
--------
%body2%
([dbody]):(djoint) - returns body2 of the joint or nil if not connected
--------
%attach%
():(djoint,[dbody],[dbody]) - connects the joint to one or two bodies. Some joints may need two bodies while other joints will merely accept anything. If nothing is passed, the joint is removed from the bodies it was attached to.
--------
%fmax2%
([float]):(djoint,[float]) - same as fmax but for axis 2
--------
%stopcfm3%
([float]):(djoint,[float]) - same as stopcfm
--------
%bounce3%
([float]):(djoint,[float]) - same as bounce but for the 3rd axis (if exits)
--------
%stoperp%
([float]):(djoint,[float]) - The error reduction parameter (ERP) used by the stops.
--------
%delete%
() : (djoint) - deletes the joint, making it invalid.
--------
%bounce2%
([float]):(djoint,[float]) - same as bounce but for the 2nd axis (if exits)
--------
%geom2%
([dgeom]):(djoint) - returns geom2 of the joint it has collided with
--------
%lostop3%
([float]):(djoint,[float]) - same as lostop but for the 3rd axis (if exists)
--------
%histop%
([float]):(djoint,[float]) - High stop angle or position. Setting this to dInfinity (the default value) turns off the high stop. For rotational joints, this stop must be less than pi to be effective. If the high stop is less than the low stop then both stops will be ineffective.
--------
%cfm%
([float]):(djoint,[float]) - The constraint force mixing (CFM) value used when not at a stop.
--------

--------
{djoint:djointamotor}
An angular motor (AMotor) allows the relative angular velocities of two bodies to be controlled. The angular velocity can be controlled on up to three axes, allowing torque motors and stops to be set for rotation about those axes. This is mainly useful in conjunction will ball joints (which do not constrain the angular degrees of freedom at all), but it can be used in any situation where angular control is needed. To use an AMotor with a ball joint, simply attach it to the same two bodies that the ball joint is attached to.
@@

%numaxes%
([int]):([int]) - Sets/gets the number of angular axes that will be controlled by the AMotor. The argument num can range from 0 (which effectively deactivates the joint) to 3. This is automatically set to 3 in eulermode
--------
%usermode%
([boolean]):(djointamotor,[boolean]) - If usermode is true, the user directly sets the axes that the AMotor controls. If it is false, eulermode is active which means that the AMotor computes the euler angles corresponding to the relative rotation, allowing euler angle torque motors and stops to be set.
--------
%anglerate%
(float):(djointamotor,int anum) - Return the current angle rate for axis anum. In usermode this is always zero, as not enough information is available. In euler mode this is the corresponding euler angle rate.
--------
%angle%
([float angle]):(djointamotor,int anum, [float angle]) - Tell the AMotor what the current angle is along axis anum. This function should only be called in user mode, because in this mode the AMotor has no other way of knowing the joint angles. The angle information is needed if stops have been set along the axis, but it is not needed for axis motors.
If no angle is passed, it return the current angle for axis anum. In user mode this is simply the value that was set with. In euler mode this is the corresponding euler angle.
--------
%axis%
([int,float x,y,z]):(djointamotor,[int anum,rel, float x,y,z]) - Sets/gets the AMotor axes. The anum argument selects the axis to change (0,1 or 2). Each axis can have one of three 'relative orientation' modes, selected by rel:
* 0: The axis is anchored to the world frame.
* 1: The axis is anchored to the first body.
* 2: The axis is anchored to the second body. 
The axis vector (x,y,z) is always specified in world coordinates regardless of the setting of rel. There are two GetAMotorAxis functions, one to return the axis and one to return the relative mode.
For dAMotorEuler mode:
* Only axes 0 and 2 need to be set. Axis 1 will be determined automatically at each time step.
* Axes 0 and 2 must be perpendicular to each other.
* Axis 0 must be anchored to the first body, axis 2 must be anchored to the second body. 

--------
%new%
(djointamotor) : ([djointgroup group]) - creates a new amotorjoint
--------

--------
{djoint:djointball}
A ball-joint that rotates without limits. Can be used to simulate ropes for example
@@

%anchor%
([float x1,y1,z1,x2,y2,z2]):(djointball,[float x,y,z]) - sets anchor point of joint if x,y,z is given (world coordinates) or returns the current anchors of the bodies if no argument is passed. Since the simulation is imperfect, there's a gap between the anchor that is set and the actual anchors of the bodies.
--------
%new%
(djointball) : ([djointgroup group]) - creates a new balljoint
--------

--------
{djoint:djointcontact}
The contact joint prevents body 1 and body 2 from inter-penetrating at the contact point. It does this by only allowing the bodies to have an 'outgoing' velocity in the direction of the contact normal. Contact joints typically have a lifetime of one time step. They are created and deleted in response to collision detection.
Contact joints can simulate friction at the contact by applying special forces in the two friction directions that are perpendicular to the normal.
@@

%normal%
(float x,y,z):(djointcontact) - returns normal of contact
--------
%approx2%
([boolean,float]):(djointcontact,[boolean on],[float]) - Use the friction pyramid approximation for friction direction 2. If this is not specified then the constant-force-limit approximation is used (and mu is a force limit).
--------
%slip2%
([boolean,float]):(djointcontact,[boolean on],[float]) - The coefficients of force-dependent-slip (FDS) for friction directions 2 (read the ode-doc).
--------
%approx1%
([boolean,float]):(djointcontact,[boolean on],[float]) - Use the friction pyramid approximation for friction direction 1. If this is not specified then the constant-force-limit approximation is used (and mu is a force limit).
--------
%softerp%
([boolean,float]):(djointcontact,[boolean on],[float]) - Contact normal 'softness' parameter.
--------
%slip1%
([boolean,float]):(djointcontact,[boolean on],[float]) - The coefficients of force-dependent-slip (FDS) for friction directions 1 (read the ode-doc).
--------
%bounce%
([boolean,float]):(djointcontact,[boolean on],[float]) - Restitution parameter (0..1). 0 means the surfaces are not bouncy at all, 1 is maximum bouncyness.
--------
%softcfm%
([boolean,float]):(djointcontact,[boolean on],[float]) - Contact normal 'softness' parameter.
--------
%bouncevel%
([boolean,float]):(djointcontact,[boolean on],[float]) - The minimum incoming velocity necessary for bounce (in m/s). Incoming velocities below this will effectively have a bounce parameter of 0.
--------
%motion2%
([boolean,float]):(djointcontact,[boolean on],[float]) - Surface velocity in friction directions 2 (in m/s).
--------
%motion1%
([boolean,float]):(djointcontact,[boolean on],[float]) - Surface velocity in friction directions 1 (in m/s).
--------
%fdir%
([boolean,float x,y,z]):(djointcontact,[boolean on],[float x,y,z]) -"first friction direction" vector that defines a direction along which frictional force is applied. It must be of unit length and perpendicular to the contact normal (so it is typically tangential to the contact surface). The "second friction direction" is a vector computed to be perpendicular to both the contact normal and fdir1.
--------
%mu2%
([boolean,float]):(djointcontact,[boolean on],[float]) - Coulomb friction coefficient for friction direction 2 (0..dInfinity).
--------
%depth%
(float x,y,z):(djointcontact) - returns depth of contact
--------
%mu%
([boolean,float]):(djointcontact,[float]) - Coulomb friction coefficient. This must be in the range 0 to dInfinity. 0 results in a frictionless contact, and dInfinity results in a contact that never slips. Note that frictionless contacts are less time consuming to compute than ones with friction, and infinite friction contacts can be cheaper than contacts with finite friction.
--------
%pos%
(float x,y,z):(djointcontact) - returns point of contact
--------

--------
{djoint:djointfixed}
The fixed joint maintains a fixed relative position and orientation between two bodies, or between a body and the static environment. Using this joint is almost never a good idea in practice, except when debugging. If you need two bodies to be glued together it is better to represent that as a single body.
@@

%setfixed%
():(djointfixed) - Call this on the fixed joint after it has been attached to remember the current desired relative offset and desired relative rotation between the bodies.
--------
%new%
(djointfixed) : ([djointgroup group]) - creates a new fixedjoint
--------

--------
{djoint:djointhinge}
Hinges are limited in their rotation at one axis. Can be used for carwheel simulation.
@@

%anchor%
([float x1,y1,z1,x2,y2,z2]):(djointhinge,[float x,y,z]) - sets anchor point in worldcoordinates if x,y,z is given. If not, the two anchorpoints are returned that both bodies apply. 
--------
%angle%
([float angle,rate]):(djointhinge) - sets/gets axis orientation of the hinge.The angle is measured between the two bodies, or between the body and the static environment. The angle will be between -pi..pi.
When the hinge anchor or axis is set, the current position of the attached bodies is examined and that position will be the zero angle. 
--------
%axis%
([float x,y,z]):(djointhinge,[float x,y,z]) - sets/gets axis orientation of the hinge 
--------
%new%
(djointhinge) : ([float x,y,z],[djointgroup group]) - creates a new hingejoint
--------

--------
{djoint:djointhinge2}
The hinge-2 joint is the same as two hinges connected in series, with different hinge axes. An example, shown in the above picture is the steering wheel of a car, where one axis allows the wheel to be steered and the other axis allows the wheel to rotate.
The hinge-2 joint has an anchor point and two hinge axes. Axis 1 is specified relative to body 1 (this would be the steering axis if body 1 is the chassis). Axis 2 is specified relative to body 2 (this would be the wheel axis if body 2 is the wheel).
Axis 1 can have joint limits and a motor, axis 2 can only have a motor.
Axis 1 can function as a suspension axis, i.e. the constraint can be compressible along that axis.
The hinge-2 joint where axis1 is perpendicular to axis 2 is equivalent to a universal joint with added suspension.
@@

%suspensioncfm%
([float]):(djointhinge2,[float]) - Suspension constraint force mixing (CFM) value
--------
%axis2%
([float x,y,z]):(djointhinge2,[float x,y,z]) - Sets/gets hinge-2 axis2. Axis 1 and axis 2 must not lie along the same line.
--------
%anglerate1%
(float):(djointhinge2) - 
--------
%suspensionerp%
([float]):(djointhinge2,[float]) - Suspension error reduction parameter (ERP)
--------
%axis1%
([float x,y,z]):(djointhinge2,[float x,y,z]) - Sets/gets hinge-2 axis1. Axis 1 and axis 2 must not lie along the same line.
--------
%anchor%
([float x,y,z]):(djointhinge2,[float x,y,z]) - Sets/gets hinge-2 anchor.
--------
%anglerate2%
(float):(djointhinge2) - 
--------
%angle1%
([float]):(djointhinge2) - 
--------
%new%
(djointhinge2) : ([djointgroup group]) - creates a new hinge2joint
--------

--------
{djoint:djointslider}
Slider joint will limit the movement between two bodies to a axis.
@@

%position%
([float position,positionrate]):(djointslider) - Get the slider linear position (i.e. the slider's 'extension') and the time derivative of this value.
--------
%axis%
([float x,y,z]):([float x,y,z]) - sets/gets axis of slider. Must be attached first, else crash is likely
--------
%new%
(djointslider):([djointgroup]) - When the axis is set, the current position of the attached bodies is examined and that position will be the zero position.
--------

--------
{djoint:djointuniversal}
A universal joint is like a ball and socket joint that constrains an extra degree of rotational freedom. Given axis 1 on body 1, and axis 2 on body 2 that is perpendicular to axis 1, it keeps them perpendicular. In other words, rotation of the two bodies about the direction perpendicular to the two axes will be equal.
In the picture, the two bodies are joined together by a cross. Axis 1 is attached to body 1, and axis 2 is attached to body 2. The cross keeps these axes at 90 degrees, so if you grab body 1 and twist it, body 2 will twist as well.
A Universal joint is equivalent to a hinge-2 joint where the hinge-2's axes are perpendicular to each other, and with a perfectly rigid connection in place of the suspension.
Universal joints show up in cars, where the engine causes a shaft, the drive shaft, to rotate along its own axis. At some point you'd like to change the direction of the shaft. The problem is, if you just bend the shaft, then the part after the bend won't rotate about its own axis. So if you cut it at the bend location and insert a universal joint, you can use the constraint to force the second shaft to rotate about the same angle as the first shaft.
Another use of this joint is to attach the arms of a simple virtual creature to its body. Imagine a person holding their arms straight out. You may want the arm to be able to move up and down, and forward and back, but not to rotate about its own axis.
@@

%anglerate1%
(float):(djointuniversal) - Gets Anglerate1
--------
%anchor%
([float x1,y1,z1,x2,y2,z2]):(djointuniversal,[float x,y,z]) - Sets/gets anchor.
--------
%anglerate2%
(float):(djointuniversal) - Gets Anglerate2
--------
%axis1%
([float x,y,z]):(djointuniversal,[float x,y,z]) - Set/gets Axis1. Axis 1 and axis 2 should be perpendicular to each other.
--------
%angle2%
(float):(djointuniversal) - Gets Angle2
--------
%axis2%
([float x,y,z]):(djointuniversal,[float x,y,z]) - Set/gets Axis2. Axis 1 and axis 2 should be perpendicular to each other.
--------
%angle1%
(float):(djointuniversal) - Gets Angle1
--------
%new%
(djointuniversal) : ([djointgroup group]) - creates a new universaljoint
--------

--------
{ode:djointgroup}
djoints can be organized in groups
@hashid, @


--------
{ode:dworld}
Luxinia uses only one world (ode can simulate multiple worlds) for the sake of simplicity. The dworld class controls the parameters of the ode object. But it also has some special functions like a surfacemanagement system. You can specify 256 different types of surface parametersets that directly set how contacts will react at each other. Each dgeom has a surfaceid and the combination of the two surfaceids will tell the automatic contactgenerator what set of surfaceparameters should be used.
@@

%contactsurfacelayer%
([float]):([float depth]) - Set and get the depth of the surface layer around all geometry objects. Contacts are allowed to sink into the surface layer up to the given depth before coming to rest. The default value is zero. Increasing this to some small value (e.g. 0.001) can help prevent jittering problems due to contacts being repeatedly made and broken.
--------
%dinfinity%
(float):() - ODE Infinity value, used by some joints.
--------
%surfacebitbounce%
([boolean]):(int surfaceid,[boolean]) - If set, the contact surface is bouncy, in other words the bodies will bounce off each other. The exact amount of bouncyness is controlled by the bounce parameter.
--------
%activebodies%
(int):() - Returns the number of currently active bodies.
--------
%surfacefdirid%
([int]):(int surfaceid,[int]) - specify the surfaceid of the geom that's fdir normal should be used. If both have the same surface id, the first geom found is used and the outcoming is undefined. The fdirid is only used if the fdirmixmode is set to 4 or 11.
--------
%surfacebounce%
([float]):(int surfaceid,[float]) - 
--------
%step%
() : (float stepsize) - make a step in simulation. We disadvise to use this function unless you are sure about its consequences. Simulations tend to produce strange error messages plus it is slower than quickstep.
--------
%surfacesofterp%
([float]):(int surfaceid,[float]) - 
--------
%surfacebitfdir%
([boolean]):(int surfaceid,[boolean]) - Compute the fdir vector using the given normals of the geoms.
--------
%getactivebody%
([dbody]):(int index) - Returns active (enabled) body of given index. 		If the index is larger than the active body count, nil is returned.
--------
%surfacebitmotion2%
([boolean]):(int surfaceid,[boolean]) - The same thing as above, but for friction direction 2.
--------
%collidetest%
() : (dspace space) - runs collisiondetection on space (and spaces in that space), resets collisionbuffer
--------
%surfacemu2%
([float]):(int surfaceid,[float]) - 
--------
%autodisabletime%
([float]) : ([float]) - minimum time until a body can be disabled after exceeding one of the thresholds.
--------
%surfacebitapprox2%
([boolean]):(int surfaceid,[boolean]) - Use the friction pyramid approximation for friction direction 2. If this is not specified then the constant-force-limit approximation is used (and mu is a force limit).
--------
%surfacemotion1%
([float]):(int surfaceid,[float]) - 
--------
%contactmaxcorrectingvel%
([float]):([float]) - Set and get the maximum correcting velocity that contacts are allowed to generate. The default value is infinity (i.e. no limit). Reducing this value can help prevent "popping" of deeply embedded objects.
--------
%surfacecombination%
([int]):(int s1,int s2,[int matid]) - sets/gets the result for the surfacecombination s1 and s2 (then the surface with surfaceid is selected for the contact parameters. The parameters s1 and s2 are symmetric, so the result for s2 and s1 is the same as for s1 and s2.
--------
%count%
(int) : () - returns sum of spaces,geoms,bodies,joints,jointgroups currently in memory
--------
%surfacefdirmixmode%
([int]):(int surfaceid,[int mode]) - The fdirmixmode specifies how the fdir vectors of different geoms should be handled. The mode values are: 
* use higher surfaceid = 0
* use lower surfaceid = 1
* use higher fdirpriority of geom = 2
* use lower fdirpriority of geom = 3
* use specified ID of surface = 4
* mix the fdirs by average = 5
* mix the fdirs using the priorities (prio1+prio2)/prio1*normal1 + (prio1+prio2)/prio2*normal2 = normal = 6

* use higher surfaceid as world coordinates = 7
* use lower surfaceid as world coordinates = 8
* use higher priority as world coordinates = 9
* use lower priority as world coordinates = 10
* use specified ID of surface = 11
* use average fdirs as world coordinates = 12
* mix the fdirs as world coordinates based on priorities = 13

--------
%surfacebitslip1%
([boolean]):(int surfaceid,[boolean]) - Force-dependent-slip (FDS) in friction direction 1.
--------
%get%
([dgeom/djoint/djointgroup]) : (int index) - each geom,joint and jointgroup (and all child classes) are stored in a global list that can be traversed.
--------
%autodisablesteps%
([int]) : ([int]) - trace depth of activation if an enabled body hits a group of disabled bodies.
--------
%surfaceslip2%
([float]):(int surfaceid,[float]) - 
--------
%iterations%
([int]) : ([int]) - sets/gets number of iterations for quickstep
--------
%surfaceslip1%
([float]):(int surfaceid,[float]) - 
--------
%surfacebitapprox1%
([boolean]):(int surfaceid,[boolean]) - Use the friction pyramid approximation for friction direction 1. If this is not specified then the constant-force-limit approximation is used (and mu is a force limit).
--------
%surfacemotion2%
([float]):(int surfaceid,[float]) - 
--------
%surfacebitsoftcfm%
([boolean]):(int surfaceid,[boolean]) - If set, the constraint force mixing parameter of the contact normal can be set with the soft_cfm parameter. This is useful to make surfaces soft.
--------
%collisionget%
([dgeom a,dgeom b]) : (int index) - gets two geoms that may are colliding
--------
%erp%
(double erp) : ([double erp]) - set/get Error Reduction Parameter (should be 0< erp < 1, default=0.2)
--------
%autodisableang%
([float]) : ([float]) - angular velocity at which the body is disabled.
--------
%autodisablevel%
([float]) : ([float]) - velocity at which the body is disabled.
--------
%makecontacts%
() : () - run this after collidetest if you want to autogenerate the contact joints. This will automaticly reset the default contactgroup.
--------
%surfacebitmotion1%
([boolean]):(int surfaceid,[boolean]) - If set, the contact surface is assumed to be moving independently of the motion of the bodies. This is kind of like a conveyor belt running over the surface. When this flag is set, motion1 defines the surface velocity in friction direction 1.
--------
%autodisable%
([boolean]) : ([boolean on]) - if switched off, bodies won't be disabled. Disabled bodies are no longer consuming CPU power.
--------
%maxcollisions%
([int]) : (int size) - sets/gets maximum number of traceable collisions. Per default this is 4000.
--------
%collisioncount%
([int]) : () - gets number of calculated collisions
--------
%surfacesoftcfm%
([float]):(int surfaceid,[float]) - 
--------
%quickstep%
() : (float stepsize) - make a quickstep in simulation
--------
%surfacebouncevel%
([float]):(int surfaceid,[float]) - 
--------
%surfacebitmu2%
([boolean]):(int surfaceid,[boolean]) - If not set, use mu for both friction directions. If set, use mu for friction direction 1, use mu2 for friction direction 2.
--------
%gravity%
(double x,y,z):([double x,y,z]) - set/get gravity
--------
%surfacebitslip2%
([boolean]):(int surfaceid,[boolean]) - Force-dependent-slip (FDS) in friction direction 2.
--------
%surfacemu%
([float]):(int surfaceid,[float]) - 
--------
%surfacebitsofterp%
([boolean]):(int surfaceid,[boolean]) - If set, the error reduction parameter of the contact normal can be set with the soft_erp parameter. This is useful to make surfaces soft.
--------
%cfm%
(double erp) : ([double cfm]) - set/get Constraint force mixing parameter (should be around 10e-9 to 1, default=10e-5)
--------

--------
{:pgraph}
profiling graph. If render.drawpgraph is enabled sampling is done per frame and rendered as line graph at the end.
@@

%getl3d%
(pgraph) : () - l3d pgraph is subpart of render pgraph)
--------
%color%
([float r,g,b]) : (pgraph,[float r,g,b]) - returns or sets color of the pgraph
--------
%getparticle%
(pgraph) : () - particle pgraph is subpart of render pgraph.
--------
%getuser0%
(pgraph) : () - user pgraph, the only ones you should be adding samples to
--------
%renderfinish%
([boolean]):([boolean]) - renderpgraph will show full rendering time, it will wait until all rendering commands are executed by driver. This will reduce performance greatly as it kills all parallelism.
--------
%getl2d%
(pgraph) : () - l2d pgraph is subpart of render pgraph
--------
%getphysics%
(pgraph) : () - ode simulation pgraph.
--------
%drawmax%
([float]) : ([pgraph],[float]) - returns or sets maximum value,individually or for all. (default is 16.667 for 60 fps as internal graphs sample in milliseconds). When drawing the values are scaled and clamped accordingly.
--------
%addsample%
() : (pgraph,float sample) - adds a sample to the cached values.
--------
%draw%
([boolean]):([pgraph],[boolean]) - draw pgraph individually or all, also enables time sampling.
--------
%getuser3%
(pgraph) : () - user pgraph, the only ones you should be adding samples to
--------
%stipple%
([float r,g,b]) : (pgraph,[float r,g,b]) - returns or sets if stippling should be used
--------
%starttimesample%
():(pgraph) - starts a time sample. (in milliseconds)
--------
%getvistest%
(pgraph) : () - vistest frame pgraph
--------
%endtimesample%
():(pgraph) - ends the time sample and adds it to graph.
--------
%drawsize%
([float x,y]) : ([float x,y]) - returns or sets size of the pgraphs
--------
%getrender%
(pgraph) : () - rendering pgraph without full accurate driver time (unless pgraph.renderfinish is set)
--------
%getuser2%
(pgraph) : () - user pgraph, the only ones you should be adding samples to
--------
%getthink%
(pgraph) : () - think pgraph (lua mostly).
--------
%drawpos%
([float x,y,z]) : ([float x,y,z]) - returns or sets position of the pgraphs
--------
%getuser1%
(pgraph) : () - user pgraph, the only ones you should be adding samples to
--------

--------
{:render}
Rendering statistics and other data. Mostly just debugging helpers.
@@

%drawtexturesize%
([float]):([float]) - sets or gets size of the special texture draw
--------
%drawfps%
([boolean]):([boolean]) - draws FPS on top right of the screen
--------
%drawlights%
([boolean]):([boolean]) - draws lightsource origins
--------
%drawvisspace%
([int]):([int]) - draws the octree of the visspace, 0 disables, 1 dynamic, 2 is static, 3 camera, 4 projector, 5 light
--------
%pauseparticles%
([boolean]):([boolean]) - if true then no new spawns, and no age updates
--------
%vistestdepth%
([boolean]):([boolean]) - sets/gets maximum octree depth for vistests.
--------
%drawnormals%
([boolean]):([boolean]) - draws red normals (blue tangents + green binormals) of the triangles
--------
%drawstencilbuffer%
([boolean]):([boolean]) - draws stencilbuffer
--------
%drawaxis%
([boolean]):([boolean]) - draws axis of objects
--------
%drawprojectors%
([boolean]):([boolean]) - draw projectors
--------
%visto%
(int):(int) - max depth (-1 will use octree's maxdepth), if you draw a visspace, you can set the min (visfrom) and max (visto) depth of the octree that should be drawn
--------
%drawtexture%
():([texture]) - draws special texture test (useful for depth or cubemap texture), if no arg is passed then drawing is disabled.
--------
%statscolor%
(float r,g,b,a):(float r,g,b,a) - sets color of stats
--------
%drawbonelimits%
([boolean]):([boolean]) - draws boneaxislimits
--------
%visfrom%
(int):(int) - min depth, if you draw a visspace, you can set the min (visfrom) and max (visto) depth of the octree that should be drawn
--------
%normallength%
([float]):([float]) - sets/gets length of drawn normals if normals are drawn.
--------
%noparticles%
([boolean]):([boolean]) - deactivates particles
--------
%drawnogui%
([boolean]):([boolean]) - disables l2dnodes and other gui items
--------
%drawwire%
([boolean]):([boolean]) - draws everthing in wiremesh
--------
%drawcamaxis%
([boolean]):([boolean]) - draws axis orientation for cameras
--------
%drawbonenames%
([boolean]):([boolean]) - draws bonenames
--------
%drawshadowvolumes%
([boolean]):([boolean]) - draw drawshadowvolumes
--------
%drawtiles%
([boolean]):([boolean]) - draw tilesets
--------
%notextures%
([boolean]):([boolean]) - deactivate textures
--------
%drawbones%
([boolean]):([boolean]) - draws bones
--------
%drawall%
([boolean]):([boolean]) - draws every node independent of vistest result
--------
%drawstats%
([boolean]):([boolean]) - draws various stats
--------

--------
{:renderinterface}
Most renderable surfaces allow a detailed control of how they are rendered. Several interfaces exist for greater control. Also some other related classes are stored here.
@@


--------
{renderinterface:blendmode}
They define how texels or pixels are blend with the destination. Sometimes you might be able to use inverte d blends, those just invert the self.alpha value
@hashid, @

%decal%
(blendmode):()- out = destination * (1-self.alpha) + self * (self.alpha)
--------
%amodadd%
(blendmode):()- out = destination + self * self.alpha
--------
%replace%
(blendmode):() - out = self
--------
%disable%
(blendmode):() - removes setting the blendmode, warning if rfBlend is still true you will get undefined behavior
--------
%modulate%
(blendmode):() - out = destination*self
--------
%add%
(blendmode):() - out = destination + self
--------

--------
{renderinterface:comparemode}
For some rendering operations you can set compare behavior. eg. GREATER means a value passes when greater than a given user threshold.
@hashid, @

%lequal%
(comparemode):() - less or equal
--------
%always%
(comparemode):() - any value passes
--------
%never%
(comparemode):() - no value passes
--------
%run%
(boolean):(comparemode,float value, float ref) - runs the comparemode and returns result
--------
%gequal%
(comparemode):() - greater or equal
--------
%equal%
(comparemode):() - 
--------
%disable%
(comparemode):() - removes setting the compare, warning if rfAlphatest is still true you will get undefined behavior
--------
%notequal%
(comparemode):() - 
--------
%greater%
(comparemode):() - 
--------
%less%
(comparemode):() - 
--------

--------
{renderinterface:indexarray}
meshes contain indices for rendering their primitives, with this interface you can modify them. Always make sure that the corresponding vertices exist and always run indexMinmax once you set all indices. If you use display lists or vbos, changes to a loaded model will not be visible.
@@

%indexTrianglecount%
([int]):(indexarray) - returns and updates the internal number of triangles based on current indexCount. This is only needed for statistics and should be called at least once after all indices were written.
--------
%indexValue%
([int value]):(indexarray,index,[int value]) - set or returns value at the given index. Make sure the corresponding vertex exists
--------
%indexUpdateVBO%
(boolean):(indexarray) - if possible resubmits array using indexAllocatedcount to VBO, returns true on success else false (no VBO or non compatible indexarray).
--------
%indexPrimitivetype%
([int]):(indexarray, [int]) - set or return the primitive type. 0 points, 1 lines, 2 lineloop, 3 linestrip, 4 triangles, 5 trianglestrip, 6 trianglefan, 7 quads, 8 quadstrip, 9 polygon (must be convex)
--------
%indexPrimitive%
([int a,b,c...]):(indexarray,primindex,[int a,b,c...]) - set or returns the primitive at given position. The function will return/need 1 index for points, 2 for lines, 3 indices for triangles, 4 indices for quads and can only return indices for any strips/loops/fan. Polygons are not supported, since the whole indexarray always contains only one.
--------
%indexPrimitivecount%
([int]):(indexarray) - returns the number of primitives based on indexCount
--------
%indexCount%
([int]):(indexarray,[int cnt]) - set or return the number of indices to be used on rendering. This value must always be smaller than Allocatedcount.
--------
%indexAllocatedcount%
([int cnt]):(indexarray) - return indices count. This is the number of indices that can be used in this indexarray, index must always be smaller than this.
--------
%indexMeshtype%
([string]):(indexarray) - returns what type of mesh the indices/vertices are stored in (unset,va,vbo) 
--------
%indexMinmax%
(int min,max):(indexarray) - computes minimum and maximum index used within indexCount. This is required for an indexarray to work, call this after all indices are set.
--------
%indexCopy%
([int]):(indexarray,int start,indexarray from,int fromstart, int size,[int vertexoffset]) - copies indices from one indexarray into self, starting at given index and optionally offsetting the copied.
--------

--------
{renderinterface:matautocontrol}
Some matcontrolids or matobject properties allow auotmatic value generation, such as tracking node positions. You can use a matautocontrol to do so. It is GCed by Lua, and will survive as long as it is used or referenced by lua.
@@

%newmatrot%
(matautocontrol):([spatialnode/l3dnode]) - autocontroller that creates matrix for rotation towards target from current node (so that 0,0,1 points to target).
--------
%newvec4posproj%
(matautocontrol):([spatialnode/l3dnode]) - autocontroller that transfers position of target in screenspace as vector.
--------
%newvec4pos%
(matautocontrol):([spatialnode/l3dnode]) - autocontroller that transfers target position as vector.
--------
%newmatposproj%
(matautocontrol):([spatialnode/l3dnode]) - autocontroller that creates matrix for translation of target in screenspace. vector.x is scale factor
--------
%target%
([spatialnode/l3dnode]):(matautocontrol,[spatialnode/l3dnode]) - returns or sets target to be tracked. After the matautocontrol has been assigned and the target becomes invalid, the matautocontrol is destroyed as well.
--------
%newmatprojector%
(matautocontrol):([l3dprojector]) - autocontroller that creates matrix for translation of target in screenspace.
--------
%newvec4dir%
(matautocontrol):([spatialnode/l3dnode]) - autocontroller that transfers direction from current to target as vector.
--------
%vector%
([float x,y,z,w]):(matautocontrol,[float x,y,z,w]) - returns or sets a custom vector that may be used by some controllers.
--------

--------
{renderinterface:matobject}
Several classes which materials can be applied to, allow the detailed control of some material values. l3dmodels need to pass 2 arguments as matobject: l3dmodel,meshid. If you pass materials, then you will change values for the default matobject. If the node's material is changed, its old materialobject will be lost.
@@

%moPos%
([float x,y,z]):(matobject,[float x,y,z]) - sets or returns position of texture matrix. Returns 0,0,0 if no matrix is set
--------
%moModoff%
(boolean):(matobject,[boolean]) - sets or returns modifiers active state
--------
%moAutotexstage%
([matautocontrol]):(matobject,int stage,boolean texgen,[matautocontrol]) - sets or returns matautocontrol for a texture stage. Use texgen=true if you want to modify texgenplanes. Note that only matrix controllers are allowed. Passing a non-matautocontrol will disable it.
--------
%moTime%
(time):(matobject,[int]) - sets or returns time value, for automatic material values. 0 means systemtime is used.
--------
%moControl%
([float ...]):(matobject,matcontrolid,[offset],[float ...]) - sets or returns materialcontrol value. Depending on length of control, 1..4 values are required. If the control value has length > 4, as in array values, the array offset is required. Offsets are multiplied by 4.
--------
%moAutocontrol%
([matautocontrol]):(matobject,matcontrolid,[matautocontrol]) - sets or returns matautocontrol for this control value. Note that only vector controllers are allowed. Passing a non-matautocontrol will disable it.
--------
%moTexmatrix%
(matrix16):(matobject,[matrix16]) - sets or returns texturematrix, pass 0 as matrix16 to disable.
--------
%moRotaxis%
([float x1,y1,z1,x2,y2,z2,x3,y3,z3]):(matobject,[float x1,y1,z1,x2,y2,z2,x3,y3,z3]) - 		sets or returns rotaxis of texture matrix. Returns 1,0,0, 0,1,0, 0,0,1 if no matrix is set. May contain scaling!
--------
%moTexcontrol%
([texture]):(matobject,matcontrolid,[texture]) - sets or returns material texcontrol value.
--------
%moSeqoff%
(boolean):(matobject,[boolean]) - sets or returns sequence play state
--------

--------
{renderinterface:matsurface}
Most renderable items allow their material to be changed. A materialsurface can either be just color, a texture or a material.
@@

%contains%
(boolean):(matsurface self, matsurface other) - checks if one matsurface contains another or is equal
--------
%vertexcolor%
(matsurface):() - removes any previous materialinfo and makes the surface just vertexcolored
--------

--------
{renderinterface:operationmode}
Some functions need this information on what to do if certain tests fail or pass
@@

%keep%
(operationmode):() - keeps old value
--------
%zero%
(operationmode):() - sets value to zero
--------
%replace%
(operationmode):() - replaces old with new value
--------
%increment%
(operationmode):() - increments old by one
--------
%invert%
(operationmode):() - inverts old
--------
%decrement%
(operationmode):() - decrements old by one
--------

--------
{renderinterface:rcmd}
The rendercommand mechanism allows you to program the renderer of each l3dview. You can precisely define what you want to render and in which order.
@@

%flag%
([boolean]):(rcmd,int id,[boolean]) - sets rcmd process bit flag. If rcmdflag of view AND the own flag bitwise return true, then the rcmd will be processed. id = 0..31
--------

--------
{rcmd:rcmdclear}
Clears drawbuffers (stencil,depth,color).
@@

%colorvalue%
([float r,g,b,a]):(rcmdclear,[float r,g,b,a]) - returns or sets
--------
%stencil%
([boolean]):(rcmdclear,[boolean]) - returns or sets
--------
%stencilvalue%
([int]):(rcmdclear,[int]) - returns or sets
--------
%color%
([boolean]):(rcmdclear,[boolean]) - returns or sets
--------
%depthvalue%
([float]):(rcmdclear,[float 0-1]) - returns or sets
--------
%depth%
([boolean]):(rcmdclear,[boolean]) - returns or sets
--------
%new%
(rcmdclear):() - returns the rcmd
--------

--------
{rcmd:rcmdcopytex}
Copys drawbuffer to texture
@@

%offset%
([int x,y]):(rcmdcopytex,[int x,y]) - returns or sets offset into texture.
--------
%side%
([int):(rcmdcopytex,[int]) - returns or sets side of texture (only for cubemaps) 0..5
--------
%tex%
([texture]):(rcmdcopytex,[texture]) - returns or sets texture
--------
%screenbounds%
([int x,y,w,h]):(rcmdcopytex,[int x,y,w,h]) - returns or sets area of window to be copied into texture. OpenGL coordinates are used.
--------
%autosize%
([int]):(rcmddraw2dmesh,[int]) - returns or sets. 0 off 1 windowsized -1 viewsized. Default is 0
--------
%new%
(rcmdcopytex):() - returns the rcmd
--------

--------
{rcmd:rcmddraw2dmesh}
Draws a 2D mesh, be aware that mesh winding is opposite (CCW) of l2dnodes (CW). Positions and sizes are always in OpenGL coordinates (0,0) = bottom left. The l2dnodes' reference size system is not used.
@vertexarray, indexarray, rendersurface, renderflag, matobject, @

%pos%
([float x,y,z]):(rcmddraw2dmesh,[float x,y,z]) - returns or sets. Only used when autosize is 0. Coordinates in OpenGL (0,0) = bottomleft
--------
%matsurface%
([matsurface]):(rcmddraw2dmesh,[matsurface]) - returns or sets matsurface
--------
%quadmesh%
():(rcmddraw2dmesh) - deletes usermesh and sets quadmesh again.
--------
%usermesh%
():(rcmddraw2dmesh, vertextype, int numverts, int numindices) - creates custom usermesh that can be filled using vertexarray and indexarray interfaces. Note that polygon winding is CCW.
--------
%color%
([float r,g,b,a]):(rcmddraw2dmesh,[float r,g,b,a]) - returns or sets color
--------
%size%
([float x,y,z]):(rcmddraw2dmesh,[float x,y,z]) - returns or sets. Only used when autosize is 0. Coordinates in OpenGL (0,0) = bottomleft
--------
%autosize%
([int]):(rcmddraw2dmesh,[int]) - returns or sets. 0 off 1 windowsized -1 viewsized. Default is 1
--------
%new%
(rcmddraw2dmesh):() - returns the rcmd
--------

--------
{rcmd:rcmddrawbg}
Draws the background of the current l3dview
@@

%new%
(rcmddrawbg):() - returns the rcmd
--------

--------
{rcmd:rcmddrawl2d}
Draws a l2dnode with its children. Useful for render-to-texture GUIs
@@

%root%
([l2dnode]):(rcmddrawl2d,[l2dnode]) - allows l2dnode drawing in this viewport. The given node will be unlinked from rest and made the master root for this view. Previous root becomes unlinked. Passing a non-l2dnode disables it.
--------
%refsize%
([float w,h]):(rcmddrawl2d,[float w,h]) - The refscreensize width/height while rendering l2droot and its children.
--------
%new%
(rcmddrawl2d):() - returns the rcmd
--------

--------
{rcmd:rcmddrawlayer}
Draws a l3dlayer
@@

%layer%
([int]):(rcmddrawlayer,[int]) - returns or sets which layer 0..15
--------
%sort%
([int]):(rcmddrawlayer,[int]) - returns or sets sorting mode for layer. 0 none 1 material -1 front-to-back -2 back-to-front. Be aware that once camera order is used, the material sortkey is overwritten. Also if you draw the same layer multiple times, you only need to sort it once.
--------
%new%
(rcmddrawlayer):() - returns the rcmd
--------

--------
{rcmd:rcmddrawprt}
Draws the particles of an l3dlayer
@@

%layer%
([int]):(rcmddrawprt,[int]) - returns or sets which layer 0..15
--------
%new%
(rcmddrawprt):() - returns the rcmd
--------

--------
{rcmd:rcmdfbo}
Binds a framebufferobject (if capability exists). Fbos allow enhanced render-to-texture operation, and off-screen rendering to large buffers. Once you start using fbos it is heavily recommended to check your setup for the whole l3dlist with l3dlist.fbotest. An fbo setup consists of rcmdfbo (for binding), rcmdfbotex or rcmdfborb for attaching renderbuffers/textures and finally the rcmdfbodrawto command which specifies which assignment the color is rendered to.
@@

%size%
([int width,height]):(rcmdfbo,[int width,height]) - returns or sets fbo size, must be defined before use, and all attachments must have equal size.
--------
%new%
(rcmdfbo):() - returns the rcmd with a new created fbo. Make sure to set size.
--------

--------
{rcmd:rcmdfbodrawto}
Sets to which color attachments it should be rendered to. Using only fragment shaders you can also write to up to four attachments simultaneously.
@@

%setup%
([int buffer0,buffer1..]):(rcmdfbodrawto,[int buffer0,buffer1..]) - returns or sets the active color drawbuffers. Only ints from 0-3 are allowed. You can specify up to 4 ints, if you want multiple rendertargets and capability exists.
--------
%new%
(rcmdfbodrawto):() - returns the rcmd. By default draws to color attach 0
--------

--------
{rcmd:rcmdfbooff}
Unbinds all bound fbos, and returns rendering to window backbuffer again.
@@

%new%
(rcmdfbooff):() - returns the rcmd
--------

--------
{rcmd:rcmdfborb}
Attaches renderbuffers to the current bound fbo.
@@

%color%
([renderbuffer]):(rcmdfborb,int clr,[renderbuffer]) - returns or sets renderbuffer attachments for color targets 0..3. You can disable certain assignments by passing 0.
--------
%depth%
([renderbuffer]):(rcmdfborb,[renderbuffer]) - returns or sets renderbuffer attachment for depth target. You can disable assignment by passing 0.
--------
%stencil%
([renderbuffer]):(rcmdfborb,[renderbuffer]) - returns or sets renderbuffer attachment for stencil target. You can disable assignment by passing 0.
--------
%new%
(rcmdfborb):() - returns the rcmd
--------

--------
{rcmd:rcmdfbotex}
Attaches textures to the current bound fbo.
@@

%color%
([texture,int special]):(rcmdfbotex,int clr,[texture,[int special]]) - returns or sets renderbuffer attachments for color targets 0..3. You can disable certain assignments by passing 0. Special is the side of a cubemap, or the z slice of a 3dtexture.
--------
%depth%
([texture]):(rcmdfbotex,[texture]) - returns or sets renderbuffer attachment for depth target. You can disable assignment by passing 0.
--------
%stencil%
([texture]):(rcmdfbotex,[texture]) - returns or sets renderbuffer attachment for stencil target. You can disable assignment by passing 0.
--------
%new%
(rcmdfbotex):() - returns the rcmd
--------

--------
{rcmd:rcmdforceflag}
Sets enforced renderflag
@renderflag, @

%new%
(rcmdforceflag):() - returns the rcmd
--------

--------
{rcmd:rcmdignore}
Ignore certain properties
@@

%lights%
([boolean]):(rcmdignore,[boolean]) - returns or sets if lights should be turned off.
--------
%projectors%
([boolean]):(rcmdignore,[boolean]) - returns or sets if projectors should be disabled.
--------
%new%
(rcmdignore):() - returns the rcmd
--------

--------
{rcmd:rcmdignoreflag}
Sets ignored renderflag
@renderflag, @

%new%
(rcmdignoreflag):() - returns the rcmd
--------

--------
{rcmd:rcmdmipmaps}
Generates mipmaps for the specified texture
@@

%texture%
([texture]):(rcmdmipmaps,[texture]) - returns or sets texture to generate mipmaps for.
--------
%new%
(rcmdmipmaps):() - returns the rcmd
--------

--------
{rcmd:rcmdshaders}
Sets use of baseshaders
@@

%shaderstage%
([int]):(rcmdshaders,[int 0-3]) - returns or sets shaderstage of the material. A material can define up to 4 shaders, the id that you pass here will be used. If a material does not have a shader with the given id, we will use the color-only baseshader. Only active if usebaseshaders is true.
--------
%shaders%
([shader color-only,shader color_lightmap,shader 1tex,shader 1tex_lightmap]):(rcmdshaders,[shader color-only,shader color_lightmap,shader 1tex,shader 1tex_lightmap]) - returns or sets baseshaders. Any non-material mesh, ie just having a texture or just having a color, will use those shaders and pass its texture (if exists) as Texture:0 to the shader.
--------
%new%
(rcmdshaders):() - returns the rcmd
--------

--------
{rcmd:rcmdshadersoff}
Disables use of l3dview baseshaders
@@

%new%
(rcmdshadersoff):() - returns the rcmd
--------

--------
{rcmd:rcmdstencil}
Sets stencil environment.
@stencilcommand, @

%new%
(rcmdstencil):() - returns the rcmd
--------

--------
{renderinterface:renderbuffer}
A renderbuffer for storing results of rendering processes for rcmdfbo attachments using rcmdfborb.
@@

%setup%
(bool):(renderbuffer,textype,int width,height) - returns if the renderbuffer could be set to the given attributes.
--------
%new%
([renderbuffer]):() - returns a new renderbuffer. You must define set its attributes prior use.
--------

--------
{renderinterface:renderflag}
For most renderable nodes you can define under what state conditions they are rendered. l3dmodels also allow renderflag to be meshid specific, if no meshid is given, we apply it to all.
@@

%rfNodepthtest%
([boolean]):(renderflag,[boolean]) - returns or sets renderflag state. When disabled only pixels that have closer or equal distance than previous pixels will be drawn.
--------
%rfNocolormask%
([boolean]):(renderflag,[boolean]) - returns or sets renderflag state. Pixel wont write into framebuffer 
--------
%rfProjectorpass%
([boolean]):(renderflag,[boolean]) - returns or sets renderflag state, forces surfaces affected by projectors into a new pass. Singlepass projector outcome sometimes might differ from multipass, especially when fog is envolved. If you need same treatment you can enforce it.
--------
%rfFrontcull%
([boolean]):(renderflag,[boolean]) - returns or sets renderflag state. Frontfaces are culled (default is off which means backfaces are culled), makes no difference when rfNocull is set
--------
%rfNodraw%
([boolean]):(renderflag,[boolean]) - returns or sets renderflag state. We will not draw the node
--------
%rfWireframe%
([boolean]):(renderflag,[boolean]) - returns or sets renderflag state, specify linewidth in rendersurface
--------
%rfBlend%
([boolean]):(renderflag,[boolean]) - returns or sets renderflag state. Blending will compute outpixel as result of previous pixel and new pixel in the framebuffer (see rendersurface).
--------
%rfFog%
([boolean]):(renderflag,[boolean]) - returns or sets renderflag state
--------
%rfAlphatest%
([boolean]):(renderflag,[boolean]) - returns or sets renderflag state. Alphatest performs a test on the pixel's alpha value. Depending on the user set comparemode and alpha threshold (see rendersurface) the pixel will be drawn or not.
--------
%rfLitSun%
([boolean]):(renderflag,[boolean]) - returns or sets renderflag state. Lit by sun
--------
%rfNormalize%
([boolean]):(renderflag,[boolean]) - returns or sets renderflag state, normalization fixes lighting problems if your models are scaled, but costs a bit more. Flag is autoset if renderscale is not 1
--------
%rfUnlit%
([boolean]):(renderflag,[boolean]) - returns or sets renderflag state. LitSun and LitFX will be ignored, this is mostly used in renderflags set by shaders.
--------
%rfStenciltest%
([boolean]):(renderflag,[boolean]) - returns or sets renderflag state. Stenciltest provides a mechanism to draw or discard pixel based on stencil buffer value. Detailed operations can be set with stencilcommand interface
--------
%rfStencilmask%
([boolean]):(renderflag,[boolean]) - returns or sets renderflag state. If set pixel will write into stencil buffer
--------
%rfNovertexcolor%
([boolean]):(renderflag,[boolean]) - returns or sets renderflag state. Vertex colors arent used, instead a single color for all.
--------
%rfLitFX%
([boolean]):(renderflag,[boolean]) - returns or sets renderflag state, only really affects l3dmodels or terrain. closest 3 l3dlights in the same l3dset will be used. If not lit by sun, but lit by fx lights we will turn ambientterm to 1, so you can use baked lighting in vertexcolors.
--------
%rfNodepthmask%
([boolean]):(renderflag,[boolean]) - returns or sets renderflag state. Output pixels will not write into Z-Buffer
--------
%rfNocull%
([boolean]):(renderflag,[boolean]) - returns or sets renderflag state. We will draw backfacing triangles too
--------
%rfNolightmap%
([boolean]):(renderflag,[boolean]) - returns or sets renderflag state. Lightmap if active for this node will not be used. Useful for disabling lightmap on permesh basis.
--------

--------
{renderinterface:rendersurface}
For most renderable nodes you can define how their surface are blend with the framebuffer, or how alpha-based rejection should be done. Enabling/disabling those effects is done with renderflags. l3dmodel is treated similar as in renderflag
@@

%rsLinefactor%
([int]):(rendersurface,[int 0-255]) - returns or sets stipple factor, is used if rfWireframe and is value is greater 0. Linestyle is define in rsLinestipple.
--------
%rsAlphacompare%
([comparemode]):(rendersurface,[comparemode]) - returns or sets alpha compare mode - only effective if rfAlphatest is set
--------
%rsLinestipple%
([string]):(rendersurface,[string]) - returns or sets stipple pattern, is used if rfWireframe is on and rsLinefactor is greater 0. The string should contain 16 0s or 1s which define the linestyle.
--------
%rsAlphavalue%
([float]):(rendersurface,[float]) - returns or sets alpha threshold
--------
%rsBlendinvert%
([boolean]):(rendersurface,[boolean]) - returns or sets blend invert of alpha-based blend types
--------
%rsLinewidth%
([float]):(rendersurface,[float]) - returns or sets linewidth for wireframes. When not set it will use whatever linewidth is currently active.
--------
%rsBlendmode%
([blendmode]):(rendersurface,[blendmode]) - only effective if rfBlend is set
--------

--------
{renderinterface:stencilcommand}
Stencilcommand allows discarding pixels based on stencil buffer. Here you can define the test and the write operations. l2dflag will ignore twosided stenciling and use front for both, else twosided stenciling is only done when the rfNoCull flag is forced. Other than that we use same operations (front) for front and back faces. Be aware that if system does not support twosided stenciling, we need to multipass, and we cannot guarantee that the result is exactly like with twosided support.
@@

%scOperation%
([operationmode fail, operationmode zfail, operationmode zpass]):(stencilcommand,int side,[operationmode fail, operationmode zfail, operationmode zpass]) - returns or sets what to do when depth/stencil fails or passes. side 0 = frontface, 1 = backface. It defines how the value is combined with the old stencilbuffer value.
--------
%scEnabled%
([boolean]):(stencilcommand,[boolean]) - returns or sets if command should be enabled
--------
%scFunction%
([comparemode front,comparemode back,int threshold, int mask]):(stencilcommand,[comparemode front,comparemode back,int threshold, int mask]) - returns or sets how the stencil test should be done, and the binary mask for before writing is done.
--------

--------
{renderinterface:technique}
Techniques are used in shaders and depend on the graphics hardware capabilities.
@@

%arb_vf_tex8%
(technique):() - same as arb_vf with 8 texturecoords
--------
%arb_vf%
(technique):() - same as arb_v but with arb_fragmentprograms support, also allows cg useage for better fragmentshaders.
--------
%arb_v%
(technique):() - arb_vertexprograms support and arb_texcomb. Basic cg vertex programs are allowed too.
--------
%supported%
(boolean):(technique) - checks if given technique is supported.
--------
%cg%
(technique):() - basic full cg support, arb_v and simple fragmentshaders. This is mostly for Geforce3 and 4.
--------
%cg_sm3_tex8%
(technique):() - advanced cg support, shader model 3.0 and 8 texturecoords
--------
%lowdetail%
(technique):() - lowdetail, overrides all other techniques
--------
%arb_texcomb%
(technique):() - arbitrary texture access in combiners, cubemap textures, dot3 combiner.
--------
%supported_tex4%
(boolean):(technique) - checks if given technique is supported with 4 textures.
--------

--------
{renderinterface:texcombiner}
A texcombiner defines how textures are blend together / what color/alpha values they return. Luxinia comes with a bunch of predefined combiners that the shadercompiler uses and which you can access in the shaderscript. If those are not enough or you need specific operations to be done you can define your own combiners. You must make sure they run well, as there wont be error checking. GL_ARB_texture_env_combine is the main extension this system builds on.
@@


--------
{texcombiner:texcombalpha}
The texcombiner for alpha values. Make sure that texcombop are only ALPHA values.
@@

%addsigned%
([texcombalpha]):(string name) -  OUT = arg0 + arg1 - 0.5
--------
%interpolate%
([texcombalpha]):(string name) -  OUT = arg0 * arg2 + arg1 * (1-arg2)
--------
%setarg%
():(texcombalpha,int arg,texcombsrc,texcombop) -  sets argument of the function. Check the function descriptor for which arg index does what. Make sure operand is always alpha or invalpha.
--------
%modulate%
([texcombalpha]):(string name) -  OUT = arg0 * arg1
--------
%modadd%
([texcombalpha]):(string name) -  OUT = arg0 * arg2 + arg1. You should query for capability. When used color mode must be modadd/combine4 for cards with combine4 support as well.
--------
%subtract%
([texcombalpha]):(string name) -  OUT = arg0 - arg1. You should query for capability. When used modadd/combine4 for color at the same time is not allowed for cards with combine4 support
--------
%combine4%
([texcombalpha]):(string name) -  OUT = arg0*arg1 + arg2*arg3. You should query for capability. Color mode must be combine4/modadd at the same time
--------
%test%
([string]):(texcombalpha) - tests the combiner (binds it). Returns GL Error string (might have other errors not bound to this problem)
--------
%replace%
([texcombalpha]):(string name) -  OUT = arg0
--------
%combine4signed%
([texcombalpha]):(string name) -  OUT = arg0*arg1 + arg2*arg3 - 0.5  You should query for capability. Color mode must be combine4/modadd at the same time
--------
%modaddsigned%
([texcombalpha]):(string name) -  OUT = arg0 * arg2 + arg1 - 0.5. You should query for capability. When used color mode must be modadd/combine4 for cards with combine4 support as well.
--------
%add%
([texcombalpha]):(string name) -  OUT = arg0 + arg1
--------

--------
{texcombiner:texcombcolor}
The texcombiner for rgb values. The functions return a texcombiner or overwrite the combiner with same name. They may return an error when a conflict with default names exists.
@@

%addsigned%
([texcombcolor]):(string name) -  OUT = arg0 + arg1 - 0.5
--------
%interpolate%
([texcombcolor]):(string name) -  OUT = arg0 * arg2 + arg1 * (1-arg2)
--------
%setarg%
():(texcombcolor,int arg,texcombsrc,texcombop) -  sets argument of the function. Check the function descriptor for which arg index does what.
--------
%test%
([string]):(texcombcolor) - tests the combiner (binds it). Returns GL Error string (might have other errors not bound to this problem)
--------
%modulate%
([texcombcolor]):(string name) -  OUT = arg0 * arg1
--------
%dot3alpha%
([texcombcolor]):(string name) -  OUT = arg0 dotproduct arg1. (args as signed vector -1,+1). Also sets alpha. You should query for capability
--------
%modadd%
([texcombcolor]):(string name) -  OUT = arg0 * arg2 + arg1. You should query for capability.
--------
%subtract%
([texcombcolor]):(string name) -  OUT = arg0 - arg1. You should query for capability. When used modadd/combine4 for alpha at the same time is not allowed for cards with combine4 support
--------
%combine4%
([texcombcolor]):(string name) -  OUT = arg0*arg1 + arg2*arg3. You should query for capability.
--------
%dot3%
([texcombcolor]):(string name) -  OUT = arg0 dotproduct arg1. (args as signed vector -1,+1). You should query for capability
--------
%replace%
([texcombcolor]):(string name) -  OUT = arg0
--------
%combine4signed%
([texcombcolor]):(string name) -  OUT = arg0*arg1 + arg2*arg3 - 0.5  You should query for capability.
--------
%modaddsigned%
([texcombcolor]):(string name) -  OUT = arg0 * arg2 + arg1 - 0.5. You should query for capability.
--------
%add%
([texcombcolor]):(string name) -  OUT = arg0 + arg1
--------

--------
{texcombiner:texcombop}
The texcombiner operand are the values that are used from the source.
@@

%color%
(texcombop):() - RGB value
--------
%invalpha%
(texcombop):() - (1 - Alpha) value
--------
%alpha%
(texcombop):() - Alpha value
--------
%invcolor%
(texcombop):() - (1 - RGB) value. (Inverted colors)
--------

--------
{texcombiner:texcombsrc}
The texcombiner source for the function specifies where values should be taken from.
@@

%texture3%
(texcombsrc):() - texture at unit 3 (needs crossbar capability / higher technique than default)
--------
%texture1%
(texcombsrc):() - texture at unit 1 (needs crossbar capability / higher technique than default)
--------
%vertex%
(texcombsrc):() - vertex color/alpha
--------
%constant%
(texcombsrc):() - constant value (texture env color)
--------
%previous%
(texcombsrc):() - previous result
--------
%texture0%
(texcombsrc):() - texture at unit 0 (needs crossbar capability / higher technique than default)
--------
%texture2%
(texcombsrc):() - texture at unit 2 (needs crossbar capability / higher technique than default)
--------
%texture%
(texcombsrc):() - current texture
--------

--------
{renderinterface:textype}
For creating textures or renderbuffers this defines the internal storage. Be aware that the rendersystem might not always be able to provide the format you asked for. Some types are baseformats which will leave it up to driver on which internalmode to pick. Formats such as depth and depth_stencil require special capabilities
@@

%abgr%
(textype):() - reverses order of data for RGBA, internal remains baseformat
--------
%lumalpha%
(textype):() - baseformat for LUMINANCE_ALPHA
--------
%lum%
(textype):() - baseformat for LUMINANCE
--------
%stencil%
(textype):() - baseformat for STENCIL_INDEX. only for renderbuffers
--------
%bgr%
(textype):() - reverses order of data for RGB, internal remains baseformat
--------
%depth24%
(textype):() - 24 bit DEPTH_COMPONENT
--------
%depth32%
(textype):() - 32 bit DEPTH_COMPONENT
--------
%rgb%
(textype):() - baseformat for RGB
--------
%depthstencil%
(textype):() - baseformat for DEPTH_STENCIL
--------
%depth16%
(textype):() - 16 bit DEPTH_COMPONENT
--------
%bgra%
(textype):() - reverses order of data for RGBA, internal remains baseformat
--------
%depth%
(textype):() - baseformat for DEPTH_COMPONENT
--------
%alpha%
(textype):() - baseformat for ALPHA
--------
%rgba%
(textype):() - baseformat for RGBA
--------

--------
{renderinterface:vertexarray}
meshes, l3dmodels (morphable or compiled) or l2dimage usermeshes contain vertices you can modify. This interface allows access to it. For models this only has effect if they are not rendered via display list, nor vbo, else those need to be updated as well.
@@

%vertexNormalTris%
([float x,y,z]):(vertexarray, int a, int b, int c, float ba, float ca) - returns interpolated normal for given triangle indices, using the barycentric coordinates.
--------
%vertexUser4%
([float x,y,z,w]):(vertexarray, int index,[float x,y,z,w]) - set or return user4 vector, only bigvertex vertexarrays will allow this. It overwrites texcoord channel 2 and 3.
--------
%vertexUpdateVBO%
(boolean):(vertexarray) - if possible resubmits array using vertexAllocatedcount to VBO, returns true on success else false (no VBO or non compatible vertexarray).
--------
%vertexTexcoord%
([float u,v]):(vertexarray, int index,[float u,v],[int texchannel 0-3]) - set or return texture coordinates for given channel. All vertices have 1 channel, without normals 2 and bigvertex 4. channel 0 is used for textures, channel 1 is used for lightmaps.
--------
%vertexColorTris%
([float r,g,b,a]):(vertexarray, int a, int b, int c, float ba, float ca) - returns interpolated color for given triangle indices, using the barycentric coordinates.
--------
%vertexPosarray%
([floatarray]):(vertexarray,[floatarray]) - returns or sets vertex position from given array (3 times the size of vertexAllocatedcount).
--------
%vertexNormal%
([float x,y,z]):(vertexarray, int index,[float x,y,z]) - set or return normal, some vertexarrays do not have normals
--------
%vertexInverttexcoord%
():(vertexarray, boolean y,[int texchannel 0-3]) - inverts y (or x) coordinates of texcoord channel for all vertices by doing 1.0f-coord. 
--------
%vertexColorarray%
([floatarray]):(vertexarray,[floatarray]) - returns or sets vertex colors from given array (4 times the size of vertexAllocatedcount).
--------
%vertexTexcoordTris%
([float u,v]):(vertexarray, int a, int b, int c, float ba, float ca,[int texchannel 0-3]) - returns texture coordinates for given triangle indices, using the barycentric coordinates.
--------
%vertexBBox%
(float minx,miny,minz,maxx,maxy,maxz):(vertexarray) - gets bounding box of vertices
--------
%vertexTransform%
():(vertexarray, matrix16) - transform all vertices with given matrix
--------
%vertexTexcoordtransform%
():(vertexarray, matrix16,[int texchannel 0-3]) - transforms texcoords by given matrix 
--------
%vertexNormalarray%
([floatarray]):(vertexarray,[floatarray]) - returns or sets vertex position from given array (3 times the size of vertexAllocatedcount).
--------
%vertexPos%
([float x,y,z]):(vertexarray, int index,[matrix16],[float x,y,z]) - set or return position. Transformed with by matrix if given.
--------
%vertexAllocatedcount%
([int cnt]):(vertexarray) - return vertex allocated count. This is the number of vertices that can be used in this vertexarray, index must always be smaller than this.
--------
%vertexPosTris%
([float x,y,z]):(vertexarray, int a, int b, int c, float ba, float ca) - returns interpolated position for given triangle indices, using the barycentric coordinates.
--------
%vertexPos2texcoord%
():(vertexarray,[float planex,y,z], [int texchannel 0-3]) - copy xy coordinates from positions to texcoord channel for all vertices, or project them on given plane normal. 
--------
%vertexCopy%
():(vertexarray, int start, vertexarray from,int fromstart, int size, [matrix16]) - copies vertices from other vertexarray, optionally with transfrom matrix.
--------
%vertexColor%
([float r,g,b,a]):(vertexarray, int index,[float r,g,b,a]) - set or return color
--------
%vertexCount%
([int cnt]):(vertexarray, [int cnt]) - set or return vertex count. This count is used for statistics and for optimizing, it can be smaller than allocated count and should be equal to the last vertex you use. Morphable l3dmodels will not allow setting it.
--------

--------
{renderinterface:vertextype}
For usercreated meshes it is necessary to specify what vertextype you want to have. Different vertextypes have different attributes and sizes.
@@

%vertex16color%
(vertextype):() - size 16 bytes, position (3 floats), color (4 unsigned byte).
--------
%vertex32texcoords%
(vertextype):() - size 32 bytes, position (3 floats), color (4 unsigned byte), 2 texcoord channels (2*2 floats).
--------
%vertex32normals%
(vertextype):() - size 32 bytes, normals (3 shorts), position (3 floats), color (4 unsigned bytes), 1 texcoord channel (2 floats).
--------
%vertex64%
(vertextype):() - size 64 bytes, normals (3 floats), position (3 floats), color (4 unsigned bytes), 4 texcoord channels (4*2 floats). The last 2 texcoord channels serve as user4 (4 floats)
--------

--------
{:rendersystem}
Rendering system information and settings
@@

%usevbos%
([boolean]):([boolean]) - sets/gets if vertex buffer objects should be enabled. This generally turns them on/off (on will have no effect if your hardware cant do it), the other option is to disable them per model.load. By default it is on if system technique is higher than VID_ARB_V.
--------
%glinfo%
(string renderer,string version, string vendor) : () - returns information about OpenGL Driver
--------
%noglextensions%
([boolean]) : ([boolean]) - sets/gets if 'nice-to-have' GLextensions are disabled. Affects system only during startup.
--------
%hwbonesparams%
([int]) : ([int]) - gets or sets how many parameters you use additionally to matrices in your gpuskin programs
--------
%batchmaxindices%
([int]):([int]) - l3dbatchbuffers will finish batch after indices are reached.
--------
%usebaseshaders%
([boolean]):([boolean]) - returns or sets if baseshaders should be used. Make sure they are specified before.
--------
%forcefinish%
([boolean]):([boolean]) - if true then renderfunction will wait until all rendering is finished before swapbuffers. Might fix issues you have.
--------
%cgcompilerargs%
([string]):([string]) - returns the cg compiler args. Args must be separated by ;
--------
%texanisotropic%
([boolean]) : ([boolean]) - gets or sets if texture anisotropic filtering should be used
--------
%baseshaders%
([shader color_only, color_lightmap, 1tex, 1tex_lightmap]):([shader color_only, color_lightmap, 1tex, 1tex_lightmap]) - returns or sets baseshaders. Any non-material mesh, ie just having a texture or just having a color, will use those shaders and pass its texture (if exists) as Texture:0 to the shader. All other materials will use the Shader:0 they come with.
--------
%purehwvertices%
([boolean]):([boolean]) - returns or sets if you can guarantee that all vertices (cept for debug helpers or font) are processed by your shaders which all use programmable pipeline. In that case we can ignore a few costly state changes that are only needed for fixed function pipeline.
--------
%glslcg%
([boolean]) : ([boolean]) - gets or sets if GLSL should be used. Setting only affects nvidia SM3 cards. Normally Cg compiles to nvidia extensions, with setting to true you can enforce glsl. Command does nothing for non shadermodel3 cards. Be aware that setting should be done on startup, changing between modes so that shaders will be in mixed types, will result into errors. The commands main purpose is to test GLSL profiles under Nvidia hardware.
--------
%batchmeshmaxtris%
([int]):([int]) - l3dbatchbuffers will immediately render meshes with less triangles.
--------
%nodefaultgpuprogs%
([boolean]) : ([boolean]) - sets/gets if defaultgpuprogs are disabled. Affects system only during startup.
--------
%force2tex%
([boolean]) : ([boolean]) - sets/gets if system should be forced to have only two textureunits, useful for debugging. Affects system only during startup.
--------
%texcompression%
([boolean]) : ([boolean]) - gets or sets if texture compression should be used
--------
%detail%
([int]) : ([int]) - gets or sets users detail setting 1 - 3, 3 = highest detail. 1 = half texture size, 16 bit. 2 = 16 bit texture, 3 = 32 bit textures.
--------

--------
{:reschunk}
resdata is separated into resource chunks, each chunk has a memory pool, and can hold a specific amount of resources. Every chunk also generates Vertex/IndexBufferObjects for the models if needed.<br><br>If you want to clear resources and keep others active during runtime, you will need multiple resource chunks. When a chunk is destroyed it will however keep the resources that are still needed by other chunks. Since the 'unique resource' lookup on loading is done over all resources and not individually to save memory, this was needed. The separation in ResourceChunks can be done only once until the built in maximums are hit. On startup a core chunk is generated, only to holdall resources that the engine itself needs. A default chunk is allocated (8 megs) afterwards. If you destroy the default, you must set up all yourself.<br> The user can specify what should happen when a chunk is full and a resource wants to be loaded in it. you can either throw an error, or just fill the next chunk.<br> <br> Resources are classified as 'direct' loaded or 'indirect' indirect are those resources that are loaded by other resources. When a ResourceChunk is reloaded only 'directlys' are loaded again, of course with their dependants This is done to prevent collecting unused resources, when e.g. materials or other scripts have changed some textures might not be needed anymore.<br> <br>
@@

%activate%
():(reschunk) - makes this the active reschunk, all new resources will be loaded into it.
--------
%vbonewsize%
([int vbo,int ibo]):([int vbo,int ibo]) - returns or sets the size of new allocated Vertex/IndexBufferObjects in KiloBytes. Be aware that using a size greater 2048, means that only vertex64 can be addressed via shorts.
--------
%getdefault%
(reschunk):() - returns default chunk (or first if default was destroyed).
--------
%getloaded%
(int count,[resource table]):(reschunk, int restype) - returns a table with all loaded resources of the given type.
--------
%clearload%
():(reschunk,int indirection) - clears all resources in this chunk.Then reloads resources with a smaller or equal indirection depth than the given, or none if indirection is negative.About indirection: eg. a model loads a texture and a material, both have a ind. depth of 1, the material loads a texture and shader, both with depth of 2. The shader finally loads another texture with depth of 3. So we have 3 textures with depths of 1,2,3 and 1 material with depth of 1, and 1 shader with depth of 1.<br>Additionally we will always try to reload resources that were referenced from other reschunks.
--------
%usecore%
():(boolean) - uses core memory chunk (very small and reserved for luxinia core modules, you should never use this).
--------
%vbostats%
(string,string):(reschunk) - returns strings on vertexbufferobjects useage statistics for this chunk.
--------
%destroydefault%
():() - destroys the default chunk. If you want to do your own handling you must call this right at start, before you create new reschunks.
--------
%getcurrent%
(reschunk):() - returns current active chunk.
--------
%new%
(reschunk):(string name,int memsize,int restypecnt...) -creates a new resource chunk, with given sized memory pool (in megabytes),and given number of openslots per restype. The slotcount comes at the 'restyped' position,if -1 is used we will try to get the maximum still available.<br> Make sure you have called destroydefault() before you use your own chunks.
--------

--------
{:resdata}
resdata holds all resources that are supposedly static, like models, textures, and are often reused, as those use different memory than the dynamic nodes that are normally created.<br> ResData is sepearted in ResourceChunks. The user specifies how many chunks he wants and how big those should be, ie how many resources of each type they can hold and how much memory they preallocate.<br> Resources are then loaded into the current active chunk, because of the linear memorypool they cannot be destroyed individually but only a total chunk can be destroyed. <br> A lot can go wrong when consumers of resource, that were in a chunk that was cleared, are still active. So the user should keep resources/consumer managment in unified blocks himself, to prevent this from happening, as he is totally responsible for it. You can always play safe and use only the main chunk that is automatically created.<br> <br>Overview on the restypes, and their int values:<br> 0  MODEL<br> 1  ANIMATION<br> 2  TEXTURE<br> 3  MATERIAL<br> 4  SHADER<br> 5  GPUPROG<br> 6  PARTICLECLOUD<br> 7  PARTICLESYS<br> 8  TBTERRAIN<br>10 SOUND<br>
@@

%gettypescount%
(int):() - returns number of types that exist. You need to pass this many counts to reschunk new.
--------
%info%
():(int restype) - prints info about the given resource type, any resource implements the 'getrestype' function
--------
%getopencount%
(int):(int restype) - returns number of open slots available for this resource type. Useful for generating reschunks.
--------
%getloadcount%
(int):(int restype) - returns number of loaded resources.
--------
%fillonlyself%
():() - when the active reschunk is full, resources will not be created. (default)
--------
%print%
():() - prints loaded resources, and reschunks to os console
--------
%filltonext%
():() - when the active reschunk is full, we will load the resource in the next one, and make that active.
--------

--------
{:resource}
Resources are files that are typically loaded from the harddisk and are not managed with dynamic memory management, but stored within a reschunk. Unloading of a loaded resources is not trivial, but possible. Unloading of resources is done by the reschunk class.<br><br>The load function will try to load the file or return the first instance of the same name. The forceload function will make sure a new copy of this resourcetype (not other resourcetypes) will be loaded
@@

%getresshortname%
(string,[string]):(resource) - returns the resource filename without paths and optional second argname
--------
%condition%
([boolean]):(string name,[boolean]) - Some resources allow sort of preprocessor settings for setups. Here you can set the values that you can query in shader,particlesys,material scripts.
--------
%getresname%
(string,[string]):(resource) - returns the resource filename and optional second argname
--------
%resuserstring%
([string]):(resource,[string]) - returns or sets a user string that is permanent for each resource. String must be shorter than 256 characters.
--------

--------
{resource:animation}
The animation contains tracks which store position, rotation and scale changes over time.		Such a tripple is called a prskey. You can use animations on bonesystems found in l3dmodels,		or evaluate prskey states for given times manually.
@hashid, @

%splineinterpolation%
(boolean):(animation,[boolean]) - sets or gets if animation uses spline interpolation for position between keys
--------
%defaultpath%
([string]):([string]) - returns or sets the default resource path. Luxinia will search in those when resources are not found.
--------
%trackcount%
(int):(animation) - returns number of tracks within the animation
--------
%getrestype%
(int restype):() - returns the resource type as int value, useful for resdata or reschunk functions
--------
%length%
(int):(animation) - returns animation length in ms
--------
%load%
([animation]):(string filename,[boolean splineinterpolation],[boolean rotationonly]) - loads a animation with given properties. default: spline=true, rotationonly=false
--------
%gettrack%
([trackid]):(animation,string trackname) - returns trackid of track within animation
--------

--------
{resource:gpuprog}
It contains code to be executed on the graphics card. Depending on whether your hardware is capable or not shaders will load gpuprogs automatically. There is als a set of standard gpuprograms in the base/gpuprogs folder of the application which are used internally to speed rendering up.
@hashid, @

%find%
([gpuprog]):(string file,string entryname) - finds a loaded gpuprog
--------
%getrestype%
(int restype):() - returns the resource type as int value, useful for resdata or reschunk functions
--------
%source%
(string):(gpuprog) - returns the source
--------
%defaultpath%
([string]):([string]) - returns or sets the default resource path. Luxinia will search in those when resources are not found.
--------

--------
{resource:material}
To allow more complex surface detail than just simple textures, materials		can be used to have more control over the surface. Every material consists of a shader		which defines how textures are blend, and textures or color definitions.<br>		See the mtlscript manual for more details.
@matobject, matsurface, hashid, @

%getalphatex%
([texture,comparemode,float ref,int texchannel]):(material,[int sid]) - returns texture and alphatesting info if the shader supports it (alphaTEX defined).
--------
%gettexcontrol%
([mattexcontrolid]):(material,string name) - returns mattexcontrolid, if found.
--------
%name%
(string):(material) - returns the name of the loaded material.
--------
%defaultpath%
([string]):([string]) - returns or sets the default resource path. Luxinia will search in those when resources are not found.
--------
%getshader%
(Shader):(material,[int sid]) - returns a shader, optional shader id can be given, defaults to 0
--------
%getrestype%
(int restype):() - returns the resource type as int value, useful for resdata or reschunk functions
--------
%load%
(Material mtl):(string filename) - loads a material. You can create a simple material with a special filename when it starts with 'MATERIAL_AUTO:'. What follows in the string should be a pipe '|' separated list of .shd or texture filenames that make the shader/texture stages. Their ids are linearly generated. For textures you can put the special texturetype before, as defined in mtl-format.		<br><br>For example: "MATERIAL_AUTO:myshader.shd|mytexture.jpg|TEXDOTZ anothertex.tga" generates a simple material using the given shader and the 2 textures from which one is a special texture.
--------
%getcontrol%
([matcontrolid]):(material,string name) - returns matcontrolid, if found.
--------

--------
{resource:model}
A model contains triangle meshes and bonesystems, it can also have skin information for weighted vertex deformation based on bones. Models can be animateable or static, they can also have normals for lighting computation or simple vertex data. The information is needed for optimized storage and rendering of the model.<br> Every model can be loaded only once, so if one instance needs lighting use neednormals.
@hashid, @

%meshcount%
(int):(model) - returns number of meshes within model.
--------
%setanimcache%
():(model,animation, int time,[matrix16 rootmatrix]) - updates the animcache of a model with the given data. There is no visual effect of this operation, but only to be able to compute animation results without visual representation and query results via the boneid functions.
--------
%bonecount%
(int):(model) - returns number of bones within model.
--------
%bbox%
([float minx,miny,minz, maxx,maxy,maxz]):(model,[matrix16/float minx,miny,minz, maxx,maxy,maxz]) - returns or sets bounding box. Returning can be done with matrix transformation applied (computes new AABB based)
--------
%getrestype%
(int restype):() - returns the resource type as int value, useful for resdata or reschunk functions
--------
%meshid%
(meshid):(model,[string meshname/int index]) - returns meshid within model. If a string is applied, a mesh with that name is seeked and if it doesn't exist, nothing is returned. If a number is passed, the mesh with this index is returned, or an error is thrown to a index out of bounds exception. The index must be >=0 and <meshcount.
--------
%skinid%
(boneid):(model,[int index]) - returns skinid within model. The skin with this index is returned, or an 		error is thrown to a index out of bounds exception. The index must be >=0 and < skincount.
--------
%skincount%
(int):(model) - returns number of skins within model.
--------
%updatebbox%
():(model) - updates bounding box based on current vertices and reference bones.
--------
%removefromanim%
():(model,animation) - when animations are applied to models, they create an assignlist for each model to speed up track/bone matching. If you know this model will not use the given animation again, you can remove it from that list for speed's sake.
--------
%getboneparents%
([table int]):(model) - returns an array of the parent index for every bone. We start at 0 not 1. -1 means it has no parent. With model.boneid(index) command you can get more info about the bone.
--------
%forceload%
(model):(string filename,[boolean animateable],[boolean neednormals],[boolean bigvertex],[boolean nodisplaylist],[boolean novbo] - same as load but enforces to load a copy if resource was loaded before.)
--------
%create%
(model):(string name, vertextype, int meshcount, int bonecount,[int skincount]) - returns an empty model, using boneid,meshid,skinid.init as well as vertex-/indexarrays you can fill it with content. To make it useable you must run the newfinish command after you set all data. There will be bonecount+meshcount bones at start, and the first bones are linked with the meshes.
--------
%boneid%
(boneid):(model,[string bonename/int index]) - returns boneid within model. If a string is applied, a bone with that name is seeked and if it doesn't exist, nothing is returned. If a number is passed, the bone with this index is returned, or an error is thrown to a index out of bounds exception. The index must be >=0 and <bonecount.
--------
%setmeshtype%
():(model,int type,[boolean lmcoords],[boolean vertexcolors]) - updates all meshes with given type: 0 auto 1 display list, 2 vertex array, 3 vertexbufferobject. defaults: lmcoords = false, vertexcolors = true
--------
%createfinish%
(model):(model,boolean animatable,[boolean nodisplaylist],[boolean novbo],[boolean lmcoords]) - returns itself after successful compiling and errorchecking. To make the model useable you must call this function after all data was set. It will load all needed textures and materials as well as creating proper bone hierarchy. If it's not animateable we will precompute all vertices and remove bonelinks from meshids, as well as compute the internal bounding box. For last two parameters see load command (set both false if you know that you will often change vertex/index data). If skins are set and model is animateable, those will be initialized as well.
--------
%load%
(model):(string filename,[boolean animateable],[boolean neednormals],[boolean bigvertex],[boolean nodisplaylist],[boolean novbo],[boolean lmcoords]) - loads a model. Bigvertex means that multiple texcoords, hardware skinning, normal mapping.. can be used. If you pass the novbo and nodisplaylist with true, then the model will not get special GL memory processing for faster rendering, it is supposedly used for compiled l3dmodels. Normally the engine will favor vbo if avaliable over displaylists. However as displaylists allow only few changes (need to use same shader, cant disable vertexcolors) depending on your needs it is useful to disable them. VBOs dont have those disadvantages, but can be costly for older cards if the model has just very few vertices.<br> When you should need lightmap texcoords use lmcoords with true.<br>(defaults: neednormals:true, rest:false)<
--------
%defaultpath%
([string]):([string]) - returns or sets the default resource path. Luxinia will search in those when resources are not found.
--------

--------
{resource:particlecloud}
A ParticleCloud contains many static particles, which are organised as groups. The user specifies all particle properties, the groups are used to handle automatic particle position updates. The fastest types to render are quad,triangle and point.
@rendersurface, renderflag, matobject, hashid, @

%drawlayer%
():(particlecloud,[l3dlayerid]) - at the end of which layer it will be drawn, l3dset info is ignored.
--------
%color%
([float r,g,b,a]):(particlecloud,[float r,g,b,a]) - gets or sets common color for all particles, if particlecolor is false.
--------
%typemodel%
():(particlecloud) - meshes taken from the given model, very expensive. Set the model with 'model' command. Faster if instancemesh is used.
--------
%clearparticles%
():(particlecloud) - delets all active particles
--------
%particlecolor%
([boolean]):(particlecloud,[boolean]) - gets or sets if particles have their own colors.
--------
%usesizemul%
([boolean]):(particlecloud,[boolean]) - if set output size is multiplied with sizemul
--------
%attpointsize%
([float min,max,alpha]):(particlecloud,[float min,max,alpha]) - gets or sets the automatic point parameter sizes. Combined with pointdist you can define how point particles should change size depending on distance.
--------
%useoriginoffset%
([boolean]):(particlecloud,[boolean]) - if set the quads/triangles center will be moved by the originoffset vector. Useful to create particles that dont have their center in the middle.
--------
%sizemul%
([float]):(particlecloud,[float]) - size multiplier applied when usesizemul is true
--------
%checkmin%
([float x,y,z]):(particlecloud,[float x,y,z]) - returns or sets minimum of the check boundingbox.
--------
%probabilityfadeout%
([float]):(particlecloud,[float]) - fadeout threshold. when particle's render probability is between probability-thresh its color alpha will be interpolated accordingly. The more it closes the probability value the less its alpha will be.
--------
%typepoint%
():(particlecloud) - just simple points, some systems may have capability for simple textured sprites. particle sizes will be ignored. but using pointsize (default 32) and attpointsize/dist you can influence the sizes.
--------
%lightmapmatrix%
([matrix16]):(particlecloud,[matrix16]) - generates texture coordinates when lightmap is used.
--------
%typetriangle%
():(particlecloud) - a single triangle facing camera
--------
%particlenormal%
([boolean]):(particlecloud,[boolean]) - will use particle's normal. Only applied when instancing renderpath is used.
--------
%instancemesh%
(boolean):(particlecloud,string meshname) - sets the instance mesh. Trys to lookup the mesh in the model that is used for rendering. If the mesh is small (only triangles/quads, max 32 vertices, 96 indices) we can instance it. Returns true on success
--------
%model%
([model]):(particlecloud,[model]) - gets or sets model, only will be used if pcloud type is also set to model.
--------
%useworldaxis%
([boolean]):(particlecloud,[boolean]) - when set the billboards will be aligned with the user given world axis and not face camera.
--------
%load%
(particlecloud):(string name,int particlecount,[int sortkey]) - loads a particlecloud with the number of given particles, the name is just a identifier
--------
%defaultpath%
([string]):([string]) - returns or sets the default resource path. Luxinia will search in those when resources are not found.
--------
%pointsize%
([float]):(particlecloud,[float]) - gets or sets particle pointsize for typepoint, size is in pixels at 640x480.
--------
%typequad%
():(particlecloud) - quad facing towards camera. origin at center
--------
%getrestype%
(int restype):() - returns the resource type as int value, useful for resdata or reschunk functions
--------
%lightmap%
([texture]):(particlecloud,[texture]) - lightmap texture to be used. for texture coordinates the world space positions are transformed with lightmapmatrix
--------
%camrotfix%
([boolean]):(particlecloud,[boolean]) - gets or sets if particle rotation is influenced by the camera orientation. Fixes billboard rotation issues when we look 'down' on particles, but will rotate them if we are the same plane as well.
--------
%sort%
([boolean]):(particlecloud,[boolean]) - gets or sets z-sort state, setting can be good for some blendtypes.
--------
%attpointdist%
([float const,lin,quad]):(particlecloud,[float const,lin,quad]) - gets or sets automatic point size attenuation along with the min and max values from pointsize.
--------
%visflag%
([boolean]):(particlecloud,int id,[boolean]) - sets visibility bit flag, default is true for id 1 and false for rest. It is bitwise 'and'ed with camera bitid to decide if particles should be drawn.
--------
%forceinstance%
([boolean]):(particlecloud,[boolean]) - will use instancing rendering even for the small normally batched billboards
--------
%inside%
([boolean]):(particlecloud,[boolean]) - gets or sets insideflag, if it is set and range is specified particles need to be within the range to be rendered.
--------
%probability%
([float]):(particlecloud,[float]) - percentage of how many particles are rendered when useprobability is true
--------
%worldaxis%
([matrix16]):(particlecloud,[matrix16]) - the user given align matrix for all billboards when useworldaxis is true. It will remove the camrotfix flag as it is unneeded.
--------
%originoffset%
([float x,y,z]):(particlecloud,[float x,y,z]) - returns or sets vector that is added to the generic quad/triangle center. Only applied if useoriginoffset is true.
--------
%checktype%
([int]):(particlecloud,[int]) - returns or sets what kind of axis aligned bounding box check should be done. Only particles within the box (defined by checkmin/max) are drawn. Checks performed are:<br> 1 = x-axis <br> 2 = y-axis <br> 3 = x,y-axis <br> 4 = z-axis <br> 5 = x,z-axis <br> 6 = y,z-axis <br> 7 = all axis <br> any other value = no check (default)
--------
%useprobability%
([boolean]):(particlecloud,[boolean]) - if set not all particles are drawn but user given percentage
--------
%particlerotate%
([boolean]):(particlecloud,[boolean]) - gets or sets if particles can have rotation.
--------
%colormul%
([float r,g,b,a]):(particlecloud,[float r,g,b,a]) - color multiplier applied when usecolormul is true
--------
%typesphere%
():(particlecloud) - spheres, that can be lit but are yet untextured
--------
%usecolormul%
([boolean]):(particlecloud,[boolean]) - if set output colors are multipiled with colormul
--------
%matsurface%
([material/texture]):(particlecloud,[matsurface]) - gets or sets what kind of material/texture should be used. If your textures contain combined sequences use sequencecount to set how many.
--------
%typehemisphere%
():(particlecloud) - hemisphere facing towards camera.
--------
%sequencecount%
([int]):(particlecloud,[int]) - gets or sets number of sequence items that the material holds.
--------
%range%
([float]):(particlecloud,[float]) - gets or sets range for particles, depending on the 'inside' flag, particles are either only drawn when inside range or outside.
--------
%nogpu%
([boolean]):(particlecloud,[boolean]) - wont use the default gpu programs
--------
%checkmax%
([float x,y,z]):(particlecloud,[float x,y,z]) - returns or sets maximum of the check boundingbox.
--------
%rotatedirection%
([boolean]):(particlecloud,[boolean]) - automaticall rotates into the direction their normals point.
--------
%smoothpoints%
([boolean]):(particlecloud,[boolean]) - gets or sets if points should be smoothed.
--------

--------
{resource:particlesys}
ParticleSystem contains of dynamic particles, which spawn at emitters and die after a given time.  The way they move and appear is controlled by the particlescript, which has its own detailed manual.  All particles of a system are rendered at the end of a l3dset and a particlesystem can be used in only one l3dst.  If you want to use the same particlesystem in multiple l3dsets, use one forceload per l3dset.<br> Compared to ParticleClouds you cannot control particles individually.
@matobject, hashid, @

%volumesize%
([float x,y,z]):(particlesys,[float x,y,z]) - size of the volume
--------
%timescale%
([float]):(particlesys,[float]) - you can slow down or speed up particle update and aging. 1.0 is default
--------
%bbox%
([float minx,miny,minz, maxx,maxy,maxz]):(model,[float minx,miny,minz, maxx,maxy,maxz]) - returns or sets bounding box
--------
%clearparticles%
():(particlesys) - deletes all active particles
--------
%worldaxis%
([matrix16]):(particlesys,[matrix16]) - the user given align matrix for all billboards when useworldaxis is true. It will remove the camrotfix flag as it is unneeded.
--------
%useprobability%
([boolean]):(particlesys,[boolean]) - if set not all particles are drawn but user given percentage
--------
%nodraw%
([boolean]):(particlesys,[boolean]) - wont draw the system
--------
%getsubsysdigits%
([string]):(particlesys,string)  - returns the special digit subsys string, to access subsys emitters in l3dpemitter, based on particle resource names (substring search is done, the preciser the resname the less ambigous). E.g "bomb,sparks" will search bomb subsys in this psys, then spark in bomb and so on. Returns nothing when not found.
--------
%sizemul%
([float]):(particlesys,[float]) - size multiplier applied when usesizemul is true
--------
%intervelocity%
([float]):(particlesys,int step (0..127),[float]) - returns or sets the velocity multiplier at the particle interpolator step.
--------
%checkmin%
([float x,y,z]):(particlesys,[float x,y,z]) - returns or sets minimum of the check boundingbox.
--------
%probabilityfadeout%
([float]):(particlesys,[float]) - fadeout threshold. when particle's render probability is between probability-thresh its color alpha will be interpolated accordingly. The more it closes the probability value the less its alpha will be.
--------
%volumeoffset%
([float x,y,z]):(particlesys,[float x,y,z]) - the position that is used when volumecaminfluence is 0
--------
%volumecaminfluence%
([float x,y,z]):(particlesys,[float x,y,z]) - how much the camera position affects the volumecenter (default is 1,1,1).
--------
%lightmapmatrix%
([matrix16]):(particlesys,[matrix16]) - generates texture coordinates when lightmap is used.
--------
%interrot%
([float]):(particlesys,int step (0..127),[float]) - returns or sets the rotation multiplier at the particle interpolator step.
--------
%usevolume%
([boolean]):(particlesys,[boolean]) - particles are kept in a box volume, and treated as infinite distribution
--------
%useworldaxis%
([boolean]):(particlesys,[boolean]) - when set the billboards will be aligned with the user given world axis and not face camera.
--------
%load%
(Particlesys psys):(string filename,[int sortkey]) - loads a particlesystem
--------
%defaultpath%
([string]):([string]) - returns or sets the default resource path. Luxinia will search in those when resources are not found.
--------
%usecolormul%
([boolean]):(particlesys,[boolean]) - if set output colors are multipiled with colormul
--------
%getrestype%
(int restype):() - returns the resource type as int value, useful for resdata or reschunk functions
--------
%lightmap%
([texture]):(particlesys,[texture]) - lightmap texture to be used. for texture coordinates the world space positions are transformed with lightmapmatrix
--------
%probability%
([float]):(particlesys,[float]) - percentage of how many particles are rendered when useprobability is true
--------
%intercolor%
([float r,g,b,a]):(particlesys,int step (0..127),[float r,g,b,a]) - returns or sets the color at the particle interpolator step.
--------
%drawlayer%
():(particlesys,[l3dlayerid]) - at the end of which layer it will be drawn, l3dset info is ignored.
--------
%checktype%
([int]):(particlesys,[int]) - returns or sets what kind of axis aligned bounding box check should be done. Only particles within the box (defined by checkmin/max) are drawn. Checks performed are:<br> 1 = x-axis <br> 2 = y-axis <br> 3 = x,y-axis <br> 4 = z-axis <br> 5 = x,z-axis <br> 6 = y,z-axis <br> 7 = all axis <br> any other value = no check (default)
--------
%getforceid%
([particleforceid]):(particlesys,string name) - returns particleforceid if found.
--------
%intersize%
([float]):(particlesys,int step (0..127),[float]) - returns or sets the size multiplier at the particle interpolator step.
--------
%colormul%
([float r,g,b,a]):(particlesys,[float r,g,b,a]) - color multiplier applied when usecolormul is true. Make sure to call this after interpolatercolors are set.
--------
%intertex%
([int]):(particlesys,int step (0..127),[int]) - returns or sets the texturenumber at the particle interpolator step.
--------
%usesizemul%
([boolean]):(particlesys,[boolean]) - if set output size is multiplied with sizemul
--------
%particlenormal%
([boolean]):(particlesys,[boolean]) - will use particle's normal. Only applied when instancing renderpath is used.
--------
%checkmax%
([float x,y,z]):(particlesys,[float x,y,z]) - returns or sets maximum of the check boundingbox.
--------
%forceinstance%
([boolean]):(particlesys,[boolean]) - will use instancing rendering even for the small normally batched billboards
--------
%visflag%
([boolean]):(particlesys,int id,[boolean]) - sets visibility bit flag, default is true for id 1 and false for rest. It is bitwise 'and'ed with camera bitid to decide if particles should be drawn.
--------
%nogpu%
([boolean]):(particlesys,[boolean]) - wont use the default gpu programs
--------
%volumedistance%
([float]):(particlesys,[float]) - distance from volume center to camera
--------
%pause%
([boolean]):(particlesys,[boolean]) - will not perform any updates to the particles
--------
%forceload%
(Particlesys psys):(string filename,[int sortkey]) - forces load of a particlesystem. If the same file was already loaded before, this will create another copy of it.
--------

--------
{resource:shader}
shader to setup blend effects between textures.<br> See the shdscript manual for more infos.
@hashid, @

%getparamid%
([shaderparamid]):(shader,string name,[int pass]) - returns id. In case param is used in multiple passes define which. (default first used).
--------
%defaultpath%
([string]):([string]) - returns or sets the default resource path. Luxinia will search in those when resources are not found.
--------
%getrestype%
(int restype):() - returns the resource type as int value, useful for resdata or reschunk functions
--------
%load%
(shader shd):(string filename) - loads a shader
--------
%param%
(float x,y,z,w):(shader,shaderparamid,[arrayoffset],[float x,y,z,w]) - returns or sets a shaderparam value, does nothing when param wasnt found. Arrayoffset only used for array parameters
--------

--------
{resource:sound}
sound resources
@hashid, @

%load%
(Sound snd):(string filename) - adds a soundfile to loaded resources
--------
%getrestype%
(int restype):() - returns the resource type as int value, useful for resdata or reschunk functions
--------
%play%
(boolean):(Sound snd) - plays a soundfile. Returns true if it plays the sound.
--------
%defaultpath%
([string]):([string]) - returns or sets the default resource path. Luxinia will search in those when resources are not found.
--------

--------
{resource:tbterrain}
tiletexture-based terrain, uses elevation data and surface layers, which are organized as tiles.<br> Every tile has 4 layers of surfacetiles. You can use up to 256 surfacetiletypes, each with a unique texture. However on an area of 32x32 tiles no more than eight textures can be used.
@hashid, @

%savesurfname%
([string]):(tbterrain,int layer,[string]) - returns or sets the savename for the surface layer (by default same as on set)
--------
%tileheight%
(TBTerrain terr):(tbterrain,int x,int y,[float height]) - returns or sets tile height
--------
%tilesurf%
(TBTerrain terr):(tbterrain,int x,int y,int layer,[int id]) - returns or sets tile surface id
--------
%save%
():(tbterrain) - saves a terrain by storing the data into the savenames
--------
%tilecolor%
(float r,g,b,a):(tbterrain,int x,int y,[float r,g,b,a]) - returns or sets tile color
--------
%savecolorname%
([string]):(tbterrain,[string]) - returns or sets the savename for the colormap (by default same as on set)
--------
%newfromtex%
(tbterrain):(string name, texture heightmap, float heightfactor, [texture colormap]) - creates a new tbterrain using the given elevation and color data. Make sure the textures kept their data, and you can free the data afterwards. If the heightmap has 4 colorvalues it is used as float texture, else the red value is multiplied by heightfactor.<br> After setting all used tiletypes and layers run the newfinish function.
--------
%newblank%
(tbterrain):(string name, int width,int height, float heightfactor) -		creates a new tbterrain. Dimensions must be >= 32.<br> After setting all used tiletypes and layers run the newfinish function.
--------
%getcoords%
(int x,y):(tbterrain,float x,y,z) - converts world position into terrain coords
--------
%size%
(int width,height):(tbterrain) - returns width and height of terrain
--------
%surfacetile%
():(tbterrain,int id, string tiletexturename) - creates a new surface tile using the given id (1..255) and creates a special texture from the given texturename.
--------
%saveobjname%
([string]):(tbterrain,int layer,[string]) - returns or sets the savename for the object layer (by default same as on set)
--------
%newspecs%
([int tilesize, int blocksize, int camtolerance, int atlascount]):([int tilesize, int blocksize, int camtolerance, int atlascount]) - default specifications for newly generated terrains. Tilesize is the length of a single tile. Blocksize is the square grid that is visible. Camtolerance means that if camera moved more than this many tiles the block is updated. Atlascount is the number of surfacetiles that can be active within current visible block.<br><br>All values passed must be even, and atlascount should be power of 2.
--------
%defaultpath%
([string]):([string]) - returns or sets the default resource path. Luxinia will search in those when resources are not found.
--------
%surfacelayer%
():(tbterrain,int id, data texture) - sets the given layer with the data from the data texture.
--------
%height%
(float height):(tbterrain self, float x,y) - returns interpolated height at x/y
--------
%saveheightname%
([string]):(tbterrain,[string]) - returns or sets the savename for the heightmap (by default same as on set)
--------
%newfinish%
():(tbterrain) - initializes all needed data for rendering. Set all known tiletypes and layers before
--------
%tileupdate%
():(tbterrain,int x,int y,[int region]) - updates tile, makes changes effective, optionally a whole region
--------
%getrestype%
(int restype):() - returns the resource type as int value, useful for resdata or reschunk functions
--------
%getheights%
(floatarray):(tbterrain) - returns a mounted floatarray, in which you can directly access heights of the terrain grid. There is steps*2+1 floats for each dimension.
--------

--------
{resource:texture}
Bitmaps that store color information.<br> There is two kind of textures: loaded from file and created in memory. Filebased textures are 'load'ed while pure memory textures are created with 'new'. Loading defaults to mipmap true and keepdata false.When a texturename looks like 'USER_TEX(myname)' then luxinia will check if a loaded texture was registered as usertex with 'myname' or if a user created texture with that name exists.
@matsurface, hashid, @

%deletevid%
() : (texture) - unloads the texture from video memory, can result into errors when you free a still in use texture.
--------
%combinecube%
(Texture tex):(stringstack,[boolean mipmap],[boolean keepdata]) - combines all 2d textures to a single cubemap, 6 textures are required
--------
%arrayset%
() : (texture, floatarray, int x,y,w,h,[boolean mask r,g,b,a]) - sets pixels from floatarry (4 floats per pixel). Optionally you can mask off certain channels.
--------
%deletedata%
() : (texture) - deletes the imagedata in system memory. you can now longer change or sample it.
--------
%loadlum%
(Texture tex):(string file,[boolean mipmap],[boolean keepdata]) - loads a luminance 1d/2d texture.
--------
%create3d%
(texture):(string name, int width, int height, int depth, textype, [boolean keepdata], [boolean nofilter],[boolean mipmap],[int data 0..2]) - creates a new empty texture in memory. Sizes must be power of two (unless np2 supported). Automatically registered as USER_TEX. Same creation, compression and mipmap rules as for new2d
--------
%uploaddata%
() : (texture,[int x,y,z,w,h,d/int side],[floatarray/staticarray uploaddata]) - will upload the current data to video memory. Only works on user-created textures with data, or if dataarray is passed. x,y,z are the starting points, w,h,d the dimension of the updated area. If arraysize does not match full texture dimension, then dataarray is assumed to be only the update rectangle. Side is for cubemaps (0-5), else cubemaps take Z as side. All numbers passed must be positive
--------
%create2d%
(texture):(string name, int width, int height,textype, [boolean keepdata], [boolean nofilter],[boolean mipmap],[int data 0..2]) - creates a new empty texture in memory. Width and height must be power of two (unless capability for rectangle textures). Data are 0 = Unsigned Byte (default), 1 = Float, 2 = HalfFloat (need capability). Automatically registered as USER_TEX. No compression supported. Mipmapping will only work when keepdata + reloaddata is used, or when hardware mipmapping exists.
--------
%clamp%
([boolean x,y,z]) : (texture,[boolean all]/[boolean x,y,z]) - sets or gets clamping of the texture. If not set texture will repeat, default is off. By passing one boolean you will toggle all, else you can specify in detail which axis to repeat/clamp.
--------
%reload%
() : (texture,[string filename,boolean keepoldsize] - reloads the texture with original (or new filename) with same specifications as on first load. The internal filename remains to be the original filename. Optionally the texture can be forced to the current texturesize.
--------
%sample%
([float r,g,b,a]):(texture,float u,v,[w],[boolean clamp]) - gets color from data texture, does clamped,bilinear filtering. More details under pixel function.
--------
%convfilterboxdata%
() : (texture,int kernelsize,[boolean wrap]) - runs convolution boxcar filter on the imagedata. wrap defaults to true
--------
%load%
(Texture tex):(string file,[boolean mipmap],[boolean keepdata],[int type]) - loads a color 1d/2d texture (RGB or RGBA depending on file). Dimension depends on file.
--------
%dimension%
(int width,height,depth,bpp,origwidth,origheight) : (texture) - will return infos about the texture. It returns the size in memory		and the original size. If system.detail() is <2, the loaded textures are resized at half of their size! If 		you do any calculations on the image depending on its size, you have to take this into account!
--------
%savetofile%
() : (texture,string filename,[int quality],[int cubeside]) - saves texture to file. quality must be within 1 and 100 and is used for .jpg (default is 85). cubeside can be 0-5 for cubemap textures (default 0)
--------
%reloaddata%
() : (texture) - deletes old image in videomemory, and uploads a new one with the current imagedata. this is slower than uploaddata but supports all textures.
--------
%load3dlum%
(Texture tex):(string file,[boolean mipmap],[boolean keepdata]) - loads a luminance 3d texture.
--------
%lightmapscale%
([float]) : (texture,[float]) - returns or sets how much the output is scaled, when this texture is used as lightmap outside of shaders (or when lightmapscale is used in shader stage)
--------
%getrestype%
(int restype):() - returns the resource type as int value, useful for resdata or reschunk functions
--------
%name%
(string):(texture tex) - returns name of texture
--------
%pack2d%
(Texture tex):(string filenameR, string filenameG, string filenameB,[string filenameA],[boolean mipmap],[boolean keepdata]) - combines all 2d textures to a single image where each image file becomes one color channel. 3 or 4 filenames required.
--------
%loadcube%
(Texture tex):(string file,[boolean mipmap],[boolean keepdata]) - loads a color cube texture (RGB or RGBA depending on file). Cube texture are either .dds or 2d image whose sides are stored (+x,-x,+y,-y,+z,-z) vertically. So that height = width*6.
--------
%combine2d%
(Texture tex):(stringstack,[boolean mipmap],[boolean keepdata]) - combines all 2d textures to a single row, ideally number of textures should be power of 2, max 64 textures
--------
%convfiltergaussdata%
() : (texture,int kernelsize,[boolean wrap]) - runs convolution gauss filter on the imagedata. wrap defaults to true
--------
%pixel%
([float r,g,b,a]):(texture,int x,y,[z],[float r,g,b,a]) - same as sample but works with discrete coordinates and can set pixels. Writing to texture is not visible until uploaddata or reloaddata was called. Z can be 0-5 for cubemap side, and 0-depth for 3d textures. If internal format is BGR/BGRA/ABGR values must be manually reordered, LUMALPHA uses R and G channels. ALPHA/LUM use R channel.)
--------
%arraydecal%
() : (texture, floatarray, int x,y,w,h,[float alphamul],[boolean mask r,g,b,a]) - decal blends the floatarray (4 floats per pixel) on top of current imagedata rectangle, defined by x,y,w,h. Optionally you can mask off certain channels.
--------
%mipmapping%
([boolean]) : (texture,[boolean]) - turn on/off mipmapping for the texture. Only works when texture was created with mipmap support.
--------
%resize%
() : (texture,int width, int height) - resizing textures. previous data is lost.
--------
%load3d%
(Texture tex):(string file,[boolean mipmap],[boolean keepdata]) - loads a color 3d texture (RGB or RGBA depending on file). 3D textures are either .dds or a 2d image whose slices are stored vertically along image height. So that depth = height/width, height = width
--------
%load3dalpha%
(Texture tex):(string file,[boolean mipmap],[boolean keepdata]) - loads a alpha 3d texture
--------
%swap%
() : (texture,texture) - swaps both texture contents, all images who already referenced one of either, now uses the other data. Names stay as they were.
--------
%loadcubeproj%
(Texture tex):(string file,[boolean mipmap],[boolean keepdata]) - loads a special color cubemap texture, generated from a single 2d image to fix backprojection problems, if nothing is specified we will use mipmapping.
--------
%loadcubelum%
(Texture tex):(string file,[boolean mipmap],[boolean keepdata]) - loads a luminance cube texture.
--------
%datapointer%
(int start, int end) : (texture) - if the texture was loaded with keepdata you can access the memory directly in other lua dlls. Be aware that you must make sure to not corrupt memory, make sure you are always smaller than the 'end' pointer.
--------
%createcube%
(texture):(string name, int size, textype, [boolean keepdata], [boolean nofilter],[boolean mipmap],[int data 0..2]) - creates a new empty texture in memory. Size must be power of two. Automatically registered as USER_TEX. Same creation, compression and mipmap rules as for new2d
--------
%registerusertex%
() : (texture,string username) - registers the texture as USER_TEX. If anyone access a texture with the name 'USER_TEX(username)' this texture will be used. The name will be unavailable once texture was deleted.
--------
%loadcubedotz%
(Texture tex):(string file,[boolean mipmap],[boolean keepdata]) - loads a special color cubemap texture, generated from a single 1d image to create a vector.dot.+Z cubemap, cube.size is half of width. -1 is left and +1 is right. if nothing is specified we will use mipmapping.
--------
%createfullwindow%
(texture):(string name,[textype],[nofilter],[int datatype]) - creates a new empty windowsized texture. Should only be used within materials or as rendertargets, else you might need to set texture matrices manually (needed if capability for rectangle textures exists). Automatically registered as USER_TEX. No mipmapping nor compression supported. By default nofilter is true and textype is rgba (internally whatever is closest to window is used). The speciality about windowsized textures is that if you change window resolution they are automatically resized.
--------
%loadalpha%
(Texture tex):(string file,[boolean mipmap],[boolean keepdata]) - loads a alpha 1d/2d texture.
--------
%loaddata%
(Texture tex):(string file) - loads a texture, but it will not be renderable. (autosets keepdata)
--------
%filter%
([boolean min,mag]) : (texture,[boolean both]/[boolean min,mag]) - returns or sets if texture filtering is used for minfication or/and magnification.
--------
%pixelbyte%
([int r,g,b,a]):(texture,int x,y,[z],[int r,g,b,a]) - same as pixel but assumes channels as byte values (0-255).
--------
%getdata%
() : (texture) - if texture was not loaded with keepdata, we can retrieve imagedata this way and set keepdata
--------
%defaultpath%
([string]):([string]) - returns or sets the default resource path. Luxinia will search in those when resources are not found.
--------
%loadcubealpha%
(Texture tex):(string file,[boolean mipmap],[boolean keepdata]) - loads a alpha cube texture
--------

--------
{:ressubid}
Some resources contain sub resources, such as a model is made of meshes. Ressubids allow access to those.
@@

%hostinfo%
(int index,[resource]):(ressubid) - returns the index in the host and the host resource
--------

--------
{ressubid:boneid}
Bone within a model. Normally reference state is returned but its also possible to retrieve animcache values.
@hashid, @

%rotrad%
(float x,y,z):(boneid,[boolean animcache]) - returns bone's reference rotation in object space. radians
--------
%matrix%
(matrix16):(boneid,[boolean animcache]) - returns bone's reference matrix in object space.
--------
%init%
():(boneid,string name,matrix16 refmatrix,[boneid parent]) - sets bonedata, only works on empty bones in model.new generated models. matrix should not have scaling.
--------
%parent%
([boneid]):(boneid) - returns parent if exists
--------
%disableaxis%
():(boneid,int axis) - disable bone's rotation axis
--------
%name%
(string):(boneid) - returns name
--------
%enableaxis%
():(boneid,int axis,boolean limit,float minangle,float maxangle) - enables a bone's rotation axis when its controlled by bonecontrol and allows limited rotation. limit is relative to reference position. 
--------
%rotaxis%
(float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz):(boneid,[boolean animcache]) - returns bone's reference rotation in object space. axis
--------
%rotdeg%
(float x,y,z):(boneid,[boolean animcache]) - returns bone's reference rotation in object space. degrees
--------
%pos%
(float x,y,z):(boneid,[boolean animcache]) - returns bone's reference position in object space
--------

--------
{ressubid:matcontrolid}
matcontrolid to access material control values in matobjects
@hashid, @


--------
{ressubid:mattexcontrolid}
mattexcontrolid to access material texcontrol values in matobjects
@hashid, @


--------
{ressubid:meshid}
Mesh within a model. Typically contains vertices and indices, as well as material information.
@vertexarray, indexarray, hashid, @

%boneid%
([boneid]):(meshid,[boneid]) - returns or sets boneid it is linked to. Only makes sense if model is animateable).
--------
%matsurface%
([matsurface]):(meshid) - returns matsurface
--------
%name%
([string]):(meshid) - returns or sets name of mesh
--------
%init%
():(meshid,string name, int vertexcount, int indicescount, [texture/material name]) - only works on empty meshes that are hosted in model.new generated model.
--------
%skinid%
([skinid]):(meshid,[skinid]) - returns or sets skinid it is linked to. Only makes sense if model is animateable).
--------
%material%
([material]):(meshid) - returns material of the mesh or nothing if there's no material
--------
%texname%
([string]):(meshid) - returns original texturename (material / texture).
--------
%texture%
([texture]):(meshid) - returns texture of the mesh or nothing if there's no texture
--------

--------
{ressubid:particleforceid}
Particle forces within particlesys allow greater control of the dynamic beahvior. You can create general effects such as  wind and gravity within the prt-script itself. However for location based effects you must add particle forces with this  class. You can also get access to the orginal prt scripts. The number of total forces per particlesys is limited to 32 and name must be shorter than 16 characters.  The more you add, the slower it will be.
@@

%linkworldref%
():(particleforceid,[actornode/scenenode]) - sets the reference for magnet,target or agedvelocity.
--------
%activate%
():(particleforceid) - force is activated.
--------
%newtarget%
([particleforceid]):(particlesys,string name) - returns a new particleforceid if particlesys had an empty slot. Target means that particles will be attracted or repulsed by target.
--------
%range%
([float]):(particleforceid,[float]) - returns or sets range for magnet.
--------
%linkbone%
():(particleforceid,[l3dmodel, boneid]) - sets the reference for magnet,target or agedvelocity. Be aware that if the linked l3dmodel is not visible then the used boneposition will be the last when it was visible.
--------
%deactivate%
():(particleforceid) - force is deactivated.
--------
%vector%
([float x,y,z]):(particleforceid,[float x,y,z]) - returns or sets the vector (must not be normalized). For wind and gravity this serves as direction and strength. For magnet and target it is an offset to the linked node.
--------
%airresistance%
([float]):(particleforceid,[float]) - returns or sets airresistance for wind.
--------
%newwind%
([particleforceid]):(particlesys,string name) - returns a new particleforceid if particlesys had an empty slot.		Wind is acceleration if slower than wind, or deceleration if faster.
--------
%delete%
():(particleforceid) - force is deleted.
--------
%agevec3%
([float x,y,z]):(particleforceid,int index,[float x,y,z]) - returns or sets the vector3 at the particle interpolator step. (for aged forces)
--------
%turbulence%
([float]):(particleforceid,[float]) - returns or sets turbulence for the effect.
--------
%strength%
([float]):(particleforceid,[float]) - returns or sets strength (positive attraction, negative repulsion) for target,magnet, agedvelocity.
--------
%newagedvelocity%
([particleforceid]):(particlesys,string name) - returns a new particleforceid if particlesys had an empty slot. Aged velocity means that velocity of the particle will be interpolated to based on its age. The age velocities must be set by the user and will be rotated by the node it is linked to
--------
%newmagnet%
([particleforceid]):(particlesys,string name) - returns a new particleforceid if particlesys had an empty slot. Magnet is similar to target but a ranged effect, only within range particles are affected and the strenght falloff is quadratic with distance
--------
%newgravity%
([particleforceid]):(particlesys,string name) - returns a new particleforceid if particlesys had an empty slot. Gravity is constant acceleration.
--------
%time%
([int start,end]):(particleforceid,[int start,end]) - returns or sets start- and endtime for force. A particle must be at least starttime (ms) old and younger than endtime to be affected. Set either to 0 to disable the check for start/endtime.
--------

--------
{ressubid:shaderparamid}
A simple vector4 within shaders, that can control gpuprogram values
@hashid, @


--------
{ressubid:skinid}
Skin within a model. Skins allow weighted vertex transforms based on the model's bones. Changing skin data after model.newfinish is not recommended.
@@

%boneid%
([boneid]):(skinid,int bindex,[boneid]) - returns or sets boneid of internal bonelist.
--------
%init%
():(skinid,int vertexcount,int bonecount) - sets skindata, only works on empty skins in model.new generated models. vertexcount must match the mesh's count the skin is for. bonecount should be the minimum number of bones you need.
--------
%skinvertexBonelookup%
([int]):(skinid,int vindex,int weight,[int lookup]) - returns or sets index to internal bonelist.
--------
%skinvertexInfluence%
([float]):(skinid,int vindex,int weight,[float influence]) - returns or sets how much the influence of the bone is. You must sort weights by descending influences and make sure they sum to 1
--------
%hwsupport%
([boolean]):(skinid,[boolean]) - returns if skinning can be done in hardware. Only valid after model.initskin was called.
--------
%skinvertexWeights%
([int]):(skinid,int vindex,[int numweights]) - returns or sets how many weights are used for this vertex. Hardware support will use 2 weights, lowdetail 1 weight, else a maximum of 4 is allowed.
--------

--------
{ressubid:trackid}
trackid - a track within animation contains prskey changes
@hashid, @

%updatekey%
():(trackid,[matrix16],int time,boolean spline) - computes key for given time
--------

--------
{:simplecollision}
A very basic collision system just allowing sphere to sphere checks and not very optimized
@@


--------
{simplecollision:simpleshape}
shapes for the simple collision system
@@


--------
{simpleshape:sphere}
a simple sphere
@hashid, @

%prevhit%
(shpere / aabox shape):(sphere self) - prev element in hitlist (ring)
--------
%r%
([float r]):(sphere self, [float r]) - radius of sphere
--------
%nexthit%
(shpere / aabox shape):(sphere self) - next element in hitlist (ring)
--------
%remove%
():(sphere self) - removes the sphere from his space
--------
%pos%
([float x,y,z]):(sphere self, [float x,y,z]) - center of sphere
--------
%prevlist%
(shpere / aabox shape):(sphere self) - prev element in spacelist (ring)
--------
%space%
([Space space]):(sphere self) - returns his space, if it is in a space
--------
%nextlist%
(shpere / aabox shape):(sphere self) - next element in spacelist (ring)
--------
%id%
([int id]):(sphere self, [int id]) - id of sphere
--------
%new%
(Sphere sphere):([float x,y,z]/[float r],[float r],[int id]) - constructs a simple sphere
--------

--------
{simplecollision:simplespace}
a simple sphere collisionspace
@hashid, @

%hitlist%
([sphere shape]/[aabox shape]):(simplespace self) - returns first element of hitlists
--------
%list%
([sphere shape]/[aabox shape]):(simplespace self) - returns first element of list
--------
%test%
(int hitcount):(simplespace self, float x,y,z,[r=0]) - tests for collision with sphere
--------
%add%
():(simplespace self,shape shape) - adds a shape to the space
--------
%new%
(SimpleSpace space):() - constructs an empty simplespace
--------

--------
{:soundcapture}
Capturing audio input from different sources. If the first call on any of the		functions of this class are done, the capturing is initialized. If the initialization fails, 		false plus the eror is returned. Further calls on functions of this class 		will be terminated too.
@@

%defaultdevice%
(string):() - returns default capture device
--------
%stop%
():() - Stops the recording and writes the buffer to the file and closes it.
--------
%devicelist%
([string,...]):() - returns a list of available devices
--------
%start%
():() - Starts recording.
--------
%open%
(boolean sucecss,[string error]):(string filename, int samplefrequence, 		int format 0...3, int buffersize, [string device]) - 		opens a device for recording. Only one open device is supported here. The 		format is a number from 0 to 3 and represents MONO 8 bit, MONO 16 bit, STEREO 		8 bit and STEREO 16 bit. If no device is given, the default device is used.
--------

--------
{:soundlistener}
The soundlistener represents the position, velocity and orientation 		of the 'microphone' in space.
@@

%orientation%
([float x,y,z,upx,upy,upz]):([float x,y,z,upx,upy,upz]) - sets/gets orientation of listener
--------
%vel%
([float x,y,z]):([float x,y,z]) - sets or gets velocity of listener
--------
%velscale%
([float scale]):([float scale]) - scaling factor for velocity vector
--------
%posscale%
([float scale]):([float scale]) - scaling factor for position vector
--------
%pos%
([float x,y,z]):([float x,y,z]) - sets or gets position of listener
--------

--------
{:soundnode}
soundnodes are sound sources in space.
@hashid, @

%pitch%
([float]):(soundnode self, [float]) - sets or gets pitch value
--------
%delete%
():(soundnode self) - deletes soundnode
--------
%rewind%
():(soundnode self) - rewinds soundnode
--------
%gain%
([float]):(soundnode self, [float]) - sets or gets gain value
--------
%velocity%
([float x,y,z]):(soundnode self, [float x,y,z]) - sets or gets velocity vector
--------
%update%
():(soundnode self) - manualy updates the node parameters (gain, pitch, position...). This is done automaticly once per frame, use this function only if you want to make your changes work instantly. Remember that sound playback is threaded and you will instantly hear any changes to the soundplayback (unlike the graphics which is synchronized per frame).
--------
%autodelete%
([boolean]):(soundnode self, [boolean]) - sets or gets autodelete value. If true, the 		soundnode is automaticly delete when the soundplaying is stoped. This is the default.
--------
%refdist%
([float]):(soundnode self, [float]) - sets or gets reference distance value
--------
%loop%
([boolean]):(soundnode self, [boolean]) - sets or gets looping value
--------
%stop%
():(soundnode self) - stops soundnode
--------
%isplaying%
(boolean):(soundnode self) - true if soundnode is playing
--------
%pos%
([float x,y,z]):(soundnode self, [float x,y,z]) - sets or gets position
--------
%pause%
():(soundnode self) - pauses soundnode
--------
%play%
(boolean):(soundnode self) - plays soundnode. Make adjustments to pitch, gain, position, etc.before calling this function, otherwise you may hear not what you expect. These properties are only updated once per frame and when play is executed. Returns true if the sound is played, false if it couldn't play it (too many sounds playing) or nil if the sound playback is disabled.
--------
%new%
(soundnode node):(Sound snd) - new soundnode
--------

--------
{:spatialnode}
Spatialnodes contain position/rotation information in the world, and can contain data used for visibility culling. There is two kinds of nodes dynamic actornodes and static scenenodes.		The purpose of scenenodes is to provide positional information in space without 		information about visual appearance or collision behavior. The matrices of the scenenode 		can be linked against l3dnodes in order to display objects on the screen.<br>		Each spatialnode has a name and can be found by using the name. Spatialnodes with the same name are 		grouped in a ring list that can be traversed.
@@


--------
{spatialnode:actornode}
The actorlist is a double linked ring list containing actornodes. The purpose of actors is to provide positional and movement information as dynamic spatialnodes. 

Actors are normaly used for objects that are moved around and can be directly linked with dbody objects, which are used in physical simulations.

!!Example
[img actornode.info.png align='left']A simple visible box, attached to an actor. The visual appearance can be manipulated with the functions listed in the l3dnode or l3dprimitive classes.

 -- connect a l3dprimitive with an actor and use another actor as camera
 UtilFunctions.simplerenderqueue() actor = actornode.new('actor')
 actor.l3d = l3dprimitive.newbox('box',1,1,1)
 actor.l3d:linkinterface(actor) -- connect the box with the actor
 cam = actornode.new('camera',5,4,3)
 l3dcamera.default():linkinterface(cam) -- use the cam actornode as camera
 cam:lookat(0,0,0, 0,0,1) -- look at 0,0,0 and up is 0,0,1

@hashid, @

%namenext%
(actornode actor):() - returns the next actor of same name. Because it is                                 a ringlist, you have to take care about your starting point of the traversion.
--------
%linkbone%
():(actornode self, l3dmodel model, string bone,[matrix16 offset]) - Links the actor to a certain bone.                                 The position of the actor can not be changed anymore when it is linked. The matrix of a bone                                 is only correct if the l3dnode is visible! Otherwise the behaviour is undefined.
--------
%new%
(actornode):(string name,[boolean drawable],[float x,y,z]) - creates a new actornode (default is drawable at 0,0,0) with the given name
--------
%rotdeg%
([float x,y,z]):(actornode self, [float x,y,z]) - sets/gets rotation in degrees
--------
%delete%
():(actornode) - deletes the actornode
--------
%vistestbbox%
([float minX,minY,minZ,maxX,maxY,maxZ]):(actornode self, [float minX,minY,minZ,maxX,maxY,maxZ]) - sets/gets visibility testing boundingbox when actornode is drawable 
--------
%next%
(actornode):(actornode) - returns the next actornode in the list (which can be the same if only one actornode is present).
--------
%vel%
([float x,y,z]):(actornode self, [float x,y,z]) - sets/gets velocity
--------
%getcount%
(int count):() - returns the current number of actornodes in the system.
--------
%fromindex%
([actornode]):(int index) - returns the actornode at the given index. Returns nothing if the index is out of bounds. Index may be negative and will count back from the end of the list then.
--------
%rotquat%
([float x,y,z,w]):(actornode self, [float x,y,z,w]) - sets/gets rotation as quaternion
--------
%matrix%
([matrix16 m]):(actornode self, [matrix16 m]) - sets/gets matrix 
--------
%lookat%
():(actornode self, float tox,toy,toz,upx,upy,upz,[int axis 0-2]) - rotates actornode to look at a point along defined axis. axis can be 0:x, 1:y (defualt) 2:z.
--------
%name%
[string name] name (ActorNode self, [string name]) - sets or gets the name
--------
%prev%
(actornode):(actornode) - returns the prev actornode in the list (which can be the same if only one actornode is present).
--------
%link%
():(actornode, [pgeom geom/other]) - links actornode to given body or                                 unlinks it if other type is given (i.e. boolean) or if nothing is given. An actor can't tell you                                 the body that it is linked to.
--------
%rotaxis%
([float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz]):(ActorNode self,[float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz]) - returns or sets rotation axis, make sure they make a orthogonal basis.
--------
%rotrad%
([float x,y,z]):(actornode self, [float x,y,z]) - sets/gets rotation in radians
--------
%pos%
([float x,y,z]):(actornode self, [float x,y,z]) - sets/gets position
--------

--------
{spatialnode:scenenode}
The SceneTree is a hierarchical SceneGraph organised as tree, containing scenenodes. 		The SceneTree is optimized for static data, for dynamic		nodes better use actornodes, however the scenenodes can be changed in position and rotation just fine as well.<br>		Retrieving world data can return wrong results, you need to wait one frame until they are uptodate or enforce a full 		tree updateall.<br>Compared to the other visual node types, scenenodes are automatically linked to the rootnode on creation, however this won't prevent garbagecollection.
@hashid, @

%localrotaxis%
([float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz]):(scenenode s3d,[float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz]) - returns or sets local rotation axis, make sure they make a orthogonal basis.
--------
%transform%
(float x,y,z):(scenenode self,float x,y,z) - transforms x,y,z with final matrix of the node into world coordinates
--------
%parent%
([scenenode parent]):(scenenode s3d,[scenenode parent]) - return or sets parent. If parent is not a scenenode, the node becomes unlinked. ==parent will prevent gc of self, unless parent is root.
--------
%worldrotaxis%
([float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz]):(scenenode s3d,[float Xx,Xy,Xz, Yx,Yy,Yz, Zx,Zy,Zz]) - returns or sets last world rotation axis, make sure they make a orthogonal basis.
--------
%updateall%
():() - done automatically before rendering is done, but if you need uptodate world data, right after setting your scenenodes, call this function.
--------
%localrotdeg%
(float x,y,z):(scenenode s3d,[float x,y,z]) - updates node's local rotation or returns it in degrees
--------
%new%
([scenenode s3d]):(string name,[boolean drawable],[float x,y,z]) - creates a new scenenode with given position as local pos. By default has root as parent.
--------
%localrotrad%
(float x,y,z):(scenenode s3d,[float x,y,z]) - updates node's local rotation or returns it in radians
--------
%delete%
():(scenenode) - removes the Node from the SceneTree and deletes it. withchildren defaults to false
--------
%vistestbbox%
([float minX,minY,minZ,maxX,maxY,maxZ]):(scenenode self, [float minX,minY,minZ,maxX,maxY,maxZ]) - sets/gets visibility testing boundingbox when scenenode is drawable 
--------
%localrotquat%
(float x,y,z,w):(scenenode s3d,[float x,y,z,w]) - updates node's local rotation or returns it as quaternion
--------
%worldrotquat%
(float x,y,z,w):(scenenode s3d,[float x,y,z,w]) - returns world rotation as quaternion
--------
%worldrotrad%
(float x,y,z):(scenenode s3d) - returns world rotation (radians)
--------
%getroot%
(scenenode s3d):() - returns the root node. The root node can't be deleted nor modified
--------
%worldrotdeg%
(float x,y,z):(scenenode s3d) - returns world rotation (degrees)
--------
%worldpos%
(float x,y,z):(scenenode s3d) - returns world position
--------
%worldmatrix%
([matrix16]):(scenenode s3d) - returns node's world matrix
--------
%localmatrix%
([matrix16]):(scenenode s3d,[matrix16]) - updates node's local matrix or returns it
--------
%terrain%
(terrain):(scenenode,[terrain]/[l3dterrain]) - returns or sets scenenode as terrain. Children will be put on terrain with local matrix Z as offset in height.
--------
%localpos%
(float x,y,z):(scenenode s3d,[float x,y,z]) - updates node's local position or returns it
--------
%getnextname%
(scenenode s3d):(scenenode s3d) - returns a node within same namegroup of given node
--------
%get%
([scenenode s3d]):(string name) - returns a node
--------

--------
{:system}
system information and settings
@@

%exit%
() : () - closes application
--------
%osinfo%
(string) : () - returns information about OS
--------
%drivesizes%
([float freetocaller,totalbytes,freebytes]):(string drive) - returns information on drive sizes or nil if not succesful
--------
%currenttime%
(float seconds) : () - returns time
--------
%maxfps%
([int]) : ([int]) - gets or sets if fps of the app should be capped, 0 is uncapped, minimum will be 15.
--------
%time%
(int milisecs, float frametimediff, float avgdiff) : () - returns time in milliseconds since start and precise difference since the last frame, plus average of last 8 frames
--------
%getmillis%
(float millis) : () - returns time in milliseconds, time is taken from motherboard high precision timer. Useful for profiling
--------
%processframe%
() : ([float timediff]) - allows manuall processing of frames. timediff is in milliseconds, if not passed we will compute from the last time this function was called. this will run all internal thinks except the lua think. You should never start this unless you want to do frame processing from this time on for the rest of the runtime. Ideally this function is part of a loop which you start right in your initialisation script. Using this kind of setup will not return the same results as the automatic think and maxfps will show no effect. For one the performance graphs will not measure the luathink correctly, as well as ode. Also the order of the thinkcycle is slightly different. Be aware that you must run swapbuffers yourself to see the result of rendering. A good order of your think would be: processframe,your changes, swapbuffers. This would be close to the internal order, just that swapbuffers is called differently, but still would allow some cpu/gpu parallelism. Internally the order of a think in automatic mode is in one frame: render, luathink, sound, actors/scenenodes,swapbuffers. <br>Compared to the manual mode of this function: sound,actors/scenenodes,render
--------
%refcount%
(int refcount) : () - returns current number of references in the system. There's (currently) a 		limit of 65000 references. Although Luxinia is using the garbage collection system of Lua, it 		permanent data outside of Lua can be created which results in memory leaks if this is not managed.
--------
%screenshotquality%
([int]) : ([int]) - quality of jpg screenshots (0-100).
--------
%drivetype%
(string type):(string drive) - returns type for given drive. A trailing backslash is required. Returns either 'unkown', 'removable', 'norootdir', 'fixed', 'cdrom', 'ramdisk' or 'remote' (network)
--------
%version%
(string version,string data,string time):() - returns luxinia version, builddate and buildtime.
--------
%projectpath%
([string]) : ([string]) - gets or sets used projectpath.
--------
%drivelist%
(string drive, ...):() - returns available drives on windows
--------
%vidinfo%
():() - prints info on renderer
--------
%autoscreenshot%
([boolean]) : ([boolean],[boolean tga]) - makes a screenshot at end of every frame.
--------
%nosound%
([boolean]) : ([boolean]) - sets/gets if sound is disabled. Affects system only during startup.
--------
%screenshot%
() : (string,[int scaling],[int quality]) - writes an jpg or tga image file in the screenshot folder, depending on the suffix of the string (.jpg or .tga - case sensitive!). The scaling should be a number >=0 and <=3 and tells luxinia the scaling factor of the screenshot. 0 means full resolution, 3 means 1/8th of the resolution. The scaling is done with a simple and fast but lowquality pixelresize. The quality integer describes the quality of the jpg compression: lower means less quality but smaller filesize. Note: Smaller files can be flushed much faster to the HD, so if you want to do a little imagesequence, you may prefer a lower resolution mode with low quality.
--------
%sleep%
() : (int millis) - trys to sleep for given time. The sleeptime will be subtracted from the next thinktime difference
--------
%drivelabel%
([string name]):(string drive) - returns drivelabel or nil if not succesful
--------
%swapbuffers%
() : () - should only be used in manual frame processing. swaps backbuffer, which we normally render to, and front buffer, which is what you see.
--------

--------
{:terraindecal}
A decalsurface on top of a terrain.
@@

%rotdeg%
([float]):(terraindecal,[float]) - rotation in degrees
--------
%delete%
():(terraindecal) - deletes decal
--------
%blendmode%
([blendmode]):(terraindecal,[blendmode]) - blendmode
--------
%deactivate%
():(terraindecal) - deactivates decal
--------
%matsurface%
([matsurface]):(terraindecal,[matsurface]) - materal/texture of decal
--------
%activate%
():(terraindecal,tbterrain,[int lifetime]) - activates decal on given terrain. optional lifetime
--------
%rotrad%
([float]):(terraindecal,[float]) - rotation in radians
--------
%size%
([float]):(terraindecal,[float]) - size
--------
%pos%
([float x,y]):(terraindecal,[float x,y]) - center of decal
--------
%new%
(terraindecal):() - new decal
--------

--------
{:window}
The graphics window luxinia runs in. Setters only have effect after update is called. Do not call setters without ever calling update.
@@

%fullscreen%
([boolean]) : ([boolean]) - gets or sets if window will be fullscreen
--------
%update%
() : () - if you have changed resolution or fullscreen state this function makes changes active
--------
%readdepth%
(float) : (float x,y) - returns depth value at window coordinate (in refsystem)
--------
%minsize%
([int w,h]) : ([int w,h]) - returns or sets minimum size of window. Only has effect in windowed mode.
--------
%res%
([int]) : ([int]) - sets window resolution 0 = 640x480x16, 1 = 800x600x16, 2 = 1024x768x16, 3 = 640x480x32, 4 = 800x600x32, 5 = 1024x768x32
--------
%size%
([int w,h]) : ([int w,h]) - returns or sets size of window. Needs window.update to show effect
--------
%depthbits%
(int) : ([int]) - returns or sets depthbits. After update this reflects the actual window value
--------
%bpp%
(int) : ([int]) - returns or sets bits per pixel (16,24,32)
--------
%multisamples%
(int) : ([int]) - returns or sets samples for fullscreen anti-aliasing. After update this reflects the actual window value
--------
%readcolor%
(float r,g,b,a) : (float x,y) - returns color value at window coordinate (in refsystem)
--------
%ontop%
([boolean]) : ([boolean]) - returns or sets if window is always on top
--------
%colorbits%
(int r,g,b,a) : () - returns actual bits used for each channel
--------
%height%
(int) : ([int]) - returns or sets height
--------
%width%
(int) : ([int]) - returns or sets width
--------
%refsize%
([int w,h]) : ([int w,h]) - sets reference size of screen (default=640,480). Reference size is mostly important for list2d rendering.
--------
%texmatrix%
(matrix16) : () - returns texture matrix for 'fullwindow' textures.
--------
%title%
() : (string) - Set the title of the window
--------
%stencilbits%
(int) : ([int]) - returns or sets stencilbits. After update this reflects the actual window value
--------
%resizemode%
([int]) : ([int mode]) - allows to get or set how the window should be resized if a user changes window size in windowed mode. 0 means size is not changed (default), 1 means size is changed, 2 size is changed and refsize is also changed to new window size.
--------
%pos%
() : (x,y) - sets window position
--------
%readstencil%
(int) : (float x,y) - returns stencil value at window coordinate (in refsystem)
--------
%resstring%
([string]) : ([string]) - gets or sets window resolution string=WIDTHxHEIGHTxBPP:DEPTH:STENCIL:FSAASAMPLES  BPP should be 16,24 or 32. Only 32 has forced alpha buffer support. You can check colorbits what kind of bits per pixel are used.
--------

--------
