Skyline Lua API
Version 1.0 RC1
Lua Script Reference for Skyline Game Engine.

#include <LUA_API_Type.h>
Public Member Functions  
int  vec2 () 
Returns a special table which is required when passing data between various commands. More...  
int  vec3 () 
Returns a special table which is required when passing data between various commands. More...  
int  vec4 () 
Returns a special table which is required when passing data between various commands. More...  
int  color () 
Returns a special table which is required when passing data between various commands. More...  
This area covers the special table functions. Many of Skylines lua commands can require special types other than the int,float etc.
These special types contain fields to easily pass related data. A common type is the vector3. This the has 3 feilds x,y,z which
can simplify code that is using vector positions.
EG.
pos.x = 10; pos.y = 1; pos.z = 0;
Using this special type we can define a variable to behave in this fashion. It can also contain optional args to initialise the new variable.
EG.
pos = newType.vec3(); OR pos = newType.vec3(10,1,10);
The returned table works in a similar way to defining a lua table with optional args. The lua equivalent is as follows:
function vec3(...) if(arg[1]==nil)then arg[1]=0;end if(arg[2]==nil)then arg[2]=0;end if(arg[3]==nil)then arg[3]=0;end return {x=arg[1],y=arg[2],z=arg[3]} end pos = vec3();
Use as newType.function()
The following code shows some of the the new types and how they can be used.
obj = 0;  Special table types coord = newType.vec2(10,50); posS = newType.vec3(); posE = newType.vec3(); col = newType.color(1,0,0,1); function onInit(objID) sky.lprint("LUA: Debub Draw 2  Active!"); obj = objID; end function onUpdate( timeDelta ) posS = newType.vec3(entity.getPosition(obj)); posE = newType.vec3(entity.getPosition(entity.getIDFromTag("t2"))) draw.line(posS,posE,col); end
For more information on how these functions can be used please visit the User Manual  http://www.chiad.com/Skyline/SDN/
int newType::color  (  ) 
Returns a special table which is required when passing data between various commands.
The special tables can all be used to define and optionally initialise a vector type variable
Here is a Small Example of how to use this function:
myCol = newType.color(1,0,0,1);
int newType::vec2  (  ) 
Returns a special table which is required when passing data between various commands.
The special tables can all be used to define and optionally initialise a vector type variable
Here is a Small Example of how to use this function:
coord = newType.vec2(10,50);
int newType::vec3  (  ) 
Returns a special table which is required when passing data between various commands.
The special tables can all be used to define and optionally initialise a vector type variable
Here is a Small Example of how to use this function:
pos = newType.vec3(0,1,0);
int newType::vec4  (  ) 
Returns a special table which is required when passing data between various commands.
The special tables can all be used to define and optionally initialise a vector type variable
Here is a Small Example of how to use this function:
quat = newType.vec4();