Global

From Crumbled World Wiki

GlobalExampleCode

Global members

type variable description
float PI 3.14159265359
int LUA_INDEX
LuaWrapper LUA

Global functions

return function description
require(string path) Include another lua file.

This is equal to just past in the file on this row.

setRestoreData(nil data) Set restore data object. if data is set and the Lua script crashes the restore function is called with the first parameter being the restore data object.

If nil is set as data no restore function is called upon a Lua script crash.

nil,nil ipairs(table tab)
nil,nil pairs(table tab)
nil,nil spairs(table tab)
assert(object input1,string output) if input1 is false or nil, it will raises an error and print the output message
abort() crashes the lua script
abort(string message) crashes the lua script with a message
string type(nil variable) returns the type name of the lua object
print(string msg) Print to console
print(Text msg) Print to console
bool doLineCollide(Line3D line) Do a collision against the entire world.
VectorVec3 createHullList3d(Mesh aMesh) Convert a mesh into a 3d hull.
VectorVec2 createHullList2d(Mesh aMesh) Convert a mesh into a 2d hull.
Matrix generateRotationMatrix(float x, float y, float z, float rotation) Create a rotation matrix.
Camera ConvertToCamera(SceneNode node) Typecast node to camera.
Panel convertToPanel(LuaObject node) Typecast node to Panel.
bool getScreenPosInsideAnyForm(Vec2 pos) Return if the screen cordinate is inside any visible form.
bool tobool(bool value) Convert input to boolean.
bool tobool(float value) Convert input to boolean. 0 is false every thing else is true
bool tobool(string value) Convert input to boolean. "true" is true everything else is false
number tonumber(number value) Convert input to number.
number tonumber(bool value) Convert input to number. return 0 or 1
number tonumber(string value) Convert input to number.
number tonumber(Text value) Convert input to number.
number tonumber(nil value) Convert input to number.
number tonumber(Object value) Convert input to number.
string tostring(nil) Convert input to string.
string tostring(boolean value) Convert boolean to string.
string tostring(string value) Convert string to string.
string tostring(table tab) Converts a table to string. can handle number,string,boolean,Vec2,Vec3,Vec4 and tables. The Table must be in a tree structure, as recursion will create an error
string tabToStrMinimal(table tab) Converts a table to string. return a minimalistic string without unnecessary spacing and line breaks. return like "{param1=1,param2=23}".
table totable(string str) Must be Lua legal code and start with a table like table = {param1=1,param2="str"}. can handle number,string,boolean,Vec2,Vec3,Vec4 and tables. The Table must be in a tree structure, as recursion will create an error.
Vec2 tovec2(string str) Convert String of format "Vec2(1,2)"
Vec3 tovec3(string str) Convert String of format "Vec3(1,2,3)"
Vec4 tovec4(string str) Convert String of format "Vec4(1,2,3,4)"
number getActiveScriptCounterTable() return the count of running script
{ name=string(), time=number(), count=number() } getScriptTimeTable() return a table of all script and amount of work time
{ name=string(), time=number(), count=number() } getGroupScriptTimeTable() return a table of all script and amount of work time

Global functions (map creation)

return function description
abort() Crashes the script
table getCrashTable() Get crash table.