Function reference for v1.5.0

Get this HTML file.
Asset.Get( assetPath, assetType, errorIfAssetNotFound ) Alias of CraftStudio.FindAsset( assetPath[, assetType] ).
Asset.GetId( asset ) Returns the asset's internal unique identifier.
Asset.GetName( asset ) Returns the name of the provided asset.
Asset.GetPath( asset ) Returns the path of the provided asset.
Camera.GetBaseDistance( camera ) Returns the perspective camera's base distance.
Camera.GetFOV( camera ) Returns the FOV of the provided perspective camera (rounded to the second digit after the coma).
Camera.GetPixelsToUnits( camera ) Returns the pixels to scene units factor.
Camera.GetUnitsToPixels( camera ) Returns the scene units to pixels factor.
Camera.IsPositionInFrustum( camera, position ) Tell whether the provided position is inside the camera's frustum.
Camera.Project( camera, position ) Projects a 3D space position to a 2D screen position.
Camera.Set( camera, params ) Apply the content of the params argument to the provided camera.
Camera.SetProjectionMode( camera, projectionMode ) Sets the camera projection mode.
Camera.WorldToScreenPoint( camera, position ) Translate a position in the scene to an on-screen position.
Color.GetHSV( color ) Return the Hue, Saturation and Value of the provided color.
Color.GetHex( color ) Return the color's hexadecimal representation.
Color.GetName( color ) Return the name of the color, provided it can be found in the `Color.colorsByName` object.
Color.GetRandom( pattern ) Returns a random color, optional of the provided pattern.
Color.HexToRGB( hex ) Convert an hexadecimal color into its RGB components.
Color.New( r, g, b ) Create a new color object.
Color.RGBToHex( r, g, b ) Return the hexadecimal representation of the provided color or r, g, b components.
Color.SetHex( color, hex ) Set the color from an hexadecimal representation.
Color.ToArray( color ) Convert the provided color object to an array.
Color.ToRGB( color ) Convert the provided color object to a table with "r", "g", "b" keys.
Color.ToString( color ) Returns a string representation of the color's components, each component being separated y a space.
Color.ToVector3( color ) Convert the provided color object to a Vector3.
Color.__add( a, b ) Allow to add two Color objects by using the + operator.
Color.__div( a, b ) Allow to divide two Color objects or a Color object and a number by using the / operator.
Color.__eq( a, b ) Allow to check for the equality between two Color objects using the == comparison operator.
Color.__mul( a, b ) Allow to multiply two Color object or a Color object and a number by using the * operator.
Color.__sub( a, b ) Allow to subtract two Color objects by using the - operator.
Component.Destroy( component ) Destroy the provided component, removing it from the game object.
Component.GetId( component ) Returns the component's internal unique identifier.
Component.Set( component, params ) Apply the content of the params argument to the provided component.
CraftStudio.Destroy( object ) Removes the specified game object (and all of its descendants) or the specified component from its game object.
CraftStudio.Input.GetMouseDelta( ) Return the mouse delta (the variation of position) since the last frame.
CraftStudio.Input.GetMousePosition( ) Return the mouse position on screen coordinates {x, y}
CraftStudio.Input.ToggleMouseLock( ) Toggle the locked state of the mouse, which can be accessed via the CraftStudio.Input.isMouseLocked property.
CraftStudio.LoadScene( sceneNameOrAsset ) Schedules loading the specified scene after the current tick (1/60th of a second) has completed.
CraftStudio.Screen.GetSize( ) Return the size of the screen, in pixels.
CraftStudio.Screen.SetSize( x, y ) Sets the size of the screen, in pixels.
CraftStudio.Storage.Load( identifier, defaultValue, callback ) Load data stored locally on the computer under the provided identifier.
CraftStudio.Storage.Save( identifier, data, callback ) Store locally on the computer the provided data under the provided identifier.
Daneel.Debug.CheckArgType( argument, argumentName, expectedArgumentTypes, p_errorHead ) Check the provided argument's type against the provided type(s) and display error if they don't match.
Daneel.Debug.CheckArgValue( argument, argumentName, expectedArgumentValues, p_errorHead, defaultValue ) Check if the provided argument's value is in the provided expected value(s).
Daneel.Debug.CheckOptionalArgType( argument, argumentName, expectedArgumentTypes, p_errorHead, defaultValue ) If the provided argument is not nil, check the provided argument's type against the provided type(s) and display error if they don't match.
Daneel.Debug.Disable( info ) Disable the debug from this point onward.
Daneel.Debug.GetNameFromValue( value ) Returns the name as a string of the global variable (including nested tables) whose value is provided.
Daneel.Debug.RegisterFunction( name, argsData ) Overload a function to call debug functions before and after it is itself called.
Daneel.Debug.RegisterObject( object ) Register all functions of an object to be included in the stacktrace.
Daneel.Debug.RegisterScript( script ) Register all functions of a scripted behavior to be included in the stacktrace.
Daneel.Debug.StackTrace.BeginFunction( functionName, ... ) Register a function call in the stack trace.
Daneel.Debug.StackTrace.EndFunction( ) Closes a successful function call, removing it from the stacktrace.
Daneel.Debug.StackTrace.Print( ) Prints the StackTrace.
Daneel.Debug.ToRawString( data ) Bypass the __tostring() function that may exists on the data's metatable.
Daneel.Debug.Try( _function ) Allow to test out a piece of code without killing the script if the code throws an error.
Daneel.DefaultConfig( ) Config, loading
Daneel.Event.AddEventListener( object, eventName, listener ) Add a listener function for the specified local event on this object.
Daneel.Event.Fire( object, eventName, ... ) Fire the provided event at the provided object or the one that listen to it, transmitting along all subsequent arguments if some exists.
Daneel.Event.Listen( eventName, functionOrObject, isPersistent ) Make the provided function or object listen to the provided event(s).
Daneel.Event.RemoveEventListener( object, eventName, listener ) Remove the specified listener for the specified local event on this object
Daneel.Event.StopListen( eventName, functionOrObject ) Make the provided function or object to stop listen to the provided event(s).
Daneel.Utilities.AllowDynamicGettersAndSetters( Object, ancestors ) Allow to call getters and setters as if they were variable on the instance of the provided object.
Daneel.Utilities.ButtonExists( buttonName ) Tell whether the provided button name exists amongst the Game Controls, or not.
Daneel.Utilities.GetId( object ) Returns an integer greater than 0 and incremented by 1 from the last time the function was called.
Daneel.Utilities.ReplaceInString( string, replacements ) Replace placeholders in the provided string with their corresponding provided replacements.
Draw.CircleRenderer.Draw( circle ) Draw the circle renderer.
Draw.CircleRenderer.GetModel( circle ) Returns the circle renderer's segment's model.
Draw.CircleRenderer.GetOpacity( circle ) Returns the circle renderer's segments' opacity.
Draw.CircleRenderer.GetRadius( circle ) Returns the circle renderer's radius.
Draw.CircleRenderer.GetSegmentCount( circle ) Returns the circle renderer's number of segments.
Draw.CircleRenderer.GetWidth( circle ) Returns the circle renderer's segment's width (and height).
Draw.CircleRenderer.New( gameObject, params ) Creates a new circle renderer component.
Draw.CircleRenderer.Set( circle, params ) Apply the content of the params argument to the provided circle renderer.
Draw.CircleRenderer.SetModel( circle, model ) Sets the circle renderer segment's model.
Draw.CircleRenderer.SetOpacity( circle, opacity ) Sets the circle renderer segments' opacity.
Draw.CircleRenderer.SetRadius( circle, radius, draw ) Sets the circle renderer's radius.
Draw.CircleRenderer.SetSegmentCount( circle, count, draw ) Sets the circle renderer's segment count.
Draw.CircleRenderer.SetWidth( circle, width ) Sets the circle renderer segment's width.
Draw.LineRenderer.Draw( line ) Draw the line renderer.
Draw.LineRenderer.GetDirection( line ) Returns the line renderer's direction.
Draw.LineRenderer.GetEndPosition( line ) Returns the line renderer's end position.
Draw.LineRenderer.GetLength( line ) Returns the line renderer's length.
Draw.LineRenderer.GetWidth( line ) Returns the line renderer's width.
Draw.LineRenderer.New( gameObject, params ) Creates a new LineRenderer component.
Draw.LineRenderer.Set( line, params ) Apply the content of the params argument to the provided line renderer.
Draw.LineRenderer.SetDirection( line, direction, useDirectionAsLength, draw ) Set the line renderer's direction.
Draw.LineRenderer.SetEndPosition( line, endPosition, draw ) Set the line renderer's end position.
Draw.LineRenderer.SetLength( line, length, draw ) Set the line renderer's length.
Draw.LineRenderer.SetWidth( line, width, draw ) Set the line renderer's width (and height).
GUI.Hud.CreateOriginGO( gameObject ) Creates a "Hud Origin" child used for positioning hud components.
GUI.Hud.GetLayer( hud ) Get the gameObject's layer.
GUI.Hud.GetLocalLayer( hud ) Get the gameObject's local layer.
GUI.Hud.GetLocalPosition( hud ) Get the local position (relative to its parent) of the gameObject on screen.
GUI.Hud.GetPosition( hud ) Get the position of the provided hud on the screen.
GUI.Hud.New( gameObject, params ) Creates a new Hud component instance.
GUI.Hud.SetLayer( hud, layer ) Set the gameObject's layer.
GUI.Hud.SetLocalLayer( hud, layer ) Set the huds's local layer.
GUI.Hud.SetLocalPosition( hud, position ) Sets the local position (relative to its parent) of the gameObject on screen .
GUI.Hud.SetPosition( hud, position ) Sets the position of the gameObject on screen.
GUI.Input.Focus( input, focus ) Set the focused state of the input.
GUI.Input.New( gameObject, params ) Creates a new GUI.Input.
GUI.Input.Update( input, text, replaceText ) Update the text of the input.
GUI.Input.UpdateCursor( input ) Update the position and opacity of the input's cursor.
GUI.ProgressBar.GetHeight( progressBar ) Get the height of the progress bar (the local scale's y component).
GUI.ProgressBar.GetValue( progressBar, getAsPercentage ) Get the current value of the progress bar.
GUI.ProgressBar.New( gameObject, params ) Creates a new GUI.ProgressBar.
GUI.ProgressBar.Set( progressBar, params ) Apply the content of the params argument to the provided progressBar.
GUI.ProgressBar.SetHeight( progressBar, height ) Set the height of the progress bar.
GUI.ProgressBar.SetValue( progressBar, value ) Set the value of the progress bar, adjusting its length.
GUI.ProgressBar.UpdateValue( progressBar, value, fireEvent ) Set the value of the progress bar, adjusting its length.
GUI.Slider.GetValue( slider, getAsPercentage ) Get the current slider's value.
GUI.Slider.New( gameObject, params ) Creates a new GUI.Slider.
GUI.Slider.Set( slider, params ) Apply the content of the params argument to the provided slider.
GUI.Slider.SetValue( slider, value ) Set the value of the slider, adjusting its position.
GUI.TextArea.AddLine( textArea, line, prepend ) Add a line to the text area's text.
GUI.TextArea.GetAlignment( textArea ) Get the component's horizontal alignment.
GUI.TextArea.GetAreaWidth( textArea ) Get the component's area width.
GUI.TextArea.GetFont( textArea ) Get the component's font used to render the text.
GUI.TextArea.GetLineHeight( textArea ) Get the component's line height.
GUI.TextArea.GetNewLine( textArea ) Get the component's newLine string.
GUI.TextArea.GetOpacity( textArea ) Get the component's opacity.
GUI.TextArea.GetText( textArea ) Get the component's text.
GUI.TextArea.GetVerticalAlignment( textArea ) Get the component's vertical alignment property.
GUI.TextArea.GetWordWrap( textArea ) Get the component's wordWrap property.
GUI.TextArea.New( gameObject, params ) Creates a new TextArea component.
GUI.TextArea.Set( textArea, params ) Apply the content of the params argument to the provided textArea.
GUI.TextArea.SetAlignment( textArea, alignment ) Set the component's alignment.
GUI.TextArea.SetAreaWidth( textArea, areaWidth ) Set the component's area width (maximum line length).
GUI.TextArea.SetFont( textArea, font ) Set the component's font used to renderer the text.
GUI.TextArea.SetLineHeight( textArea, lineHeight ) Set the component's line height.
GUI.TextArea.SetNewLine( textArea, newLine ) Set the component's newLine string used by SetText() to split the input text in several lines.
GUI.TextArea.SetOpacity( textArea, opacity ) Set the component's opacity.
GUI.TextArea.SetText( textArea, text ) Set the component's text.
GUI.TextArea.SetVerticalAlignment( textArea, verticalAlignment ) Set the component's vertical alignment.
GUI.TextArea.SetWordWrap( textArea, wordWrap ) Set the component's wordWrap property.
GUI.ToPixel( value, screenSide, camera ) Convert the provided value (a length) in a number expressed in screen pixel.
GUI.ToSceneUnit( value, camera ) Convert the provided value (a length) in a number expressed in scene unit.
GUI.Toggle.Check( toggle, state, forceUpdate ) Check or uncheck the provided toggle and fire the OnUpdate event.
GUI.Toggle.GetGroup( toggle ) Get the toggle's group.
GUI.Toggle.GetText( toggle ) Get the provided toggle's text.
GUI.Toggle.New( gameObject, params ) Creates a new Toggle component.
GUI.Toggle.Set( toggle, params ) Apply the content of the params argument to the provided toggle.
GUI.Toggle.SetGroup( toggle, group ) Set the toggle's group.
GUI.Toggle.SetText( toggle, text ) Set the provided toggle's text.
GameObject.AddComponent( gameObject, componentType, params ) Add a component to the game object and optionally initialize it.
GameObject.AddEventListener( gameObject, eventName, listener ) Add a listener function for the specified local event on this game object.
GameObject.AddTag( gameObject, tag ) Add the provided tag(s) to the provided game object.
GameObject.Animate( gameObject, property, endValue, duration, onCompleteCallback, params ) Creates an animation (a tweener) with the provided parameters.
GameObject.Destroy( gameObject ) Destroy the game object at the end of this frame.
GameObject.Display( gameObject, value, forceUseLocalPosition ) Display or hide the game object.
GameObject.FireEvent( gameObject, eventName, ... ) Fire an event at the provided game object.
GameObject.Get( name, errorIfGameObjectNotFound ) Alias of CraftStudio.FindGameObject(name).
GameObject.GetChild( gameObject, name, recursive ) Alias of GameObject.FindChild().
GameObject.GetChildren( gameObject, recursive, includeSelf ) Get all descendants of the game object.
GameObject.GetComponent( gameObject, componentType ) Get the first component of the provided type attached to the game object.
GameObject.GetId( gameObject ) Returns the game object's internal unique identifier.
GameObject.GetInAncestors( gameObject, searchFunction ) Search the ancestors of the provided game object.
GameObject.GetScriptedBehavior( gameObject, scriptNameOrAsset ) Get the provided scripted behavior instance attached to the game object.
GameObject.GetTags( gameObject ) Returns the tag(s) of the provided game object.
GameObject.GetWithTag( tag ) Returns the game object(s) that have all the provided tag(s).
GameObject.HasTag( gameObject, tag, atLeastOneTag ) Tell whether the provided game object has all (or at least one of) the provided tag(s).
GameObject.Instantiate( name, sceneNameOrAsset, params ) Create a new game object with the content of the provided scene and optionally initialize it.
GameObject.New( name, params ) Create a new game object and optionally initialize it.
GameObject.RemoveEventListener( gameObject, eventName, listener ) Remove the specified listener for the specified local event on this game object
GameObject.RemoveTag( gameObject, tag ) Remove the provided tag(s) from the provided game object.
GameObject.SendMessage( gameObject, functionName, data ) Tries to call a method with the provided name on all the scriptedBehaviors attached to the game object.
GameObject.Set( gameObject, params ) Apply the content of the params argument to the provided game object.
GameObject.SetParent( gameObject, parentNameOrInstance, keepLocalTransform ) Set the game object's parent.
Lang.Get( key, replacements ) Get the localized line identified by the provided key.
Lang.RegisterForUpdate( gameObject, key, replacements ) Register a game object to update its text renderer whenever the language will be updated by Lang.Update().
Lang.Update( language ) Update the current language and the text of all game objects that have registered via Lang.RegisterForUpdate().
Map.GetBlockIDAt( map, x, y, z ) Returns A block ID between 0-254 if a block exists at the given location (all valid block IDs are in the range 0-254), otherwise f there is no block at the given location then it will return Map.EmptyBlockID (which has a value of 255).
Map.GetBlockOrientationAt( map, x, y, z ) Returns The block orientation of the block at the specified location, otherwise if there is no block at the given location it will return Map.BlockOrientation.North.
Map.SetBlockAt( map, x, y, z, id, orientation ) Sets a block's ID and block orientation at the given location on the map.
MapRenderer.LoadNewMap( mapRenderer, callback ) Dynamically loads a new version of the provided map renderer's map and sets it as the map renderer new map.
MapRenderer.Set( mapRenderer, params ) Apply the content of the params argument to the provided map renderer.
MapRenderer.SetMap( mapRenderer, mapNameOrAsset, replaceTileSet ) Attach the provided map to the provided map renderer.
MapRenderer.SetTileSet( mapRenderer, tileSetNameOrAsset ) Set the specified tileSet for the mapRenderer's map.
ModelRenderer.GetColor( modelRenderer ) Get the color of the provided model renderer.
ModelRenderer.Set( modelRenderer, params ) Apply the content of the params argument to the provided model renderer.
ModelRenderer.SetAnimation( modelRenderer, animationNameOrAsset ) Set the specified animation for the modelRenderer's current model.
ModelRenderer.SetColor( modelRenderer, color ) Set the color of the provided model renderer.
ModelRenderer.SetModel( modelRenderer, modelNameOrAsset ) Attach the provided model to the provided modelRenderer.
MouseInput.GetTags( mouseInput ) Return the tag(s) of the game objects the component works with.
MouseInput.New( gameObject, params ) Create a new MouseInput component.
MouseInput.SetTags( mouseInput, tags ) Set tag(s) of the game objects the component works with.
MouseInput.Update( mouseInput ) Update the specified MouseInput component or update all components when no argument is passed.
Ray.Cast( ray, gameObjects, sortByDistance ) Check the collision of the ray against the provided set of game objects.
Ray.IntersectsGameObject( ray, gameObjectNameOrInstance ) Check if the ray intersects the specified game object.
RaycastHit.New( params ) Create a new RaycastHit
Scene.Append( sceneNameOrAsset, parentNameOrInstance ) Alias of CraftStudio.AppendScene().
Scene.Load( sceneNameOrAsset ) Alias of CraftStudio.LoadScene().
Sound.Play( soundAssetOrPath, volume, pitch, pan ) Play the specified sound.
TextRenderer.GetColor( textRenderer ) Get the color of the provided text renderer.
TextRenderer.SetAlignment( textRenderer, alignment ) Set the text's alignment.
TextRenderer.SetColor( textRenderer, color ) Set the color of the provided text renderer.
TextRenderer.SetFont( textRenderer, fontNameOrAsset ) Set the provided font to the provided text renderer.
TextRenderer.SetTextWidth( textRenderer, width ) Update the game object's scale to make the text appear the provided width.
Transform.GetScale( transform ) Get the transform's global scale.
Transform.LocalToWorld( transform, position ) Transform a position local to this transform to a global position.
Transform.SetLocalScale( transform, scale ) Set the transform's local scale.
Transform.SetScale( transform, scale ) Set the transform's global scale.
Transform.WorldToLocal( transform, position ) Transform a global position to a position local to this transform.
Trigger.GetGameObjectsInRange( trigger ) Get the gameObjects that are within range of that trigger.
Trigger.GetRange( trigger ) Get the range of the trigger.
Trigger.GetTags( trigger ) Return the tag(s) of the game objects the component works with.
Trigger.GetUpdateInterval( trigger ) Get the interval (in frames) at which the trigger is automatically updated.
Trigger.IsGameObjectInRange( trigger, gameObject, triggerPosition ) Tell whether the provided game object is in range of the trigger.
Trigger.New( gameObject, params ) Create a new Trigger component.
Trigger.SetRange( trigger, range ) Set the range of the trigger.
Trigger.SetTags( trigger, tags ) Set tag(s) of the game objects the component works with.
Trigger.SetUpdateInterval( trigger, updateInterval ) Set the interval (in frames) at which the trigger is automatically updated.
Tween.Timer.New( duration, callback, isInfiniteLoop, params ) Creates a new tweener via one of the two allowed constructors :
Timer.New(duration, OnCompleteCallback[, params])
Timer.New(duration, OnLoopCompleteCallback, true[, params])
Tween.Tweener.Complete( tweener ) Complete the tweener fire the OnComple event.
Tween.Tweener.Destroy( tweener ) Destroy the tweener.
Tween.Tweener.New( target, property, endValue, duration, onCompleteCallback, params ) Creates a new tweener via one of the three allowed constructors :
Tweener.New(target, property, endValue, duration[, params])
Tweener.New(startValue, endValue, duration[, params])
Tweener.New(params)
Tween.Tweener.Pause( tweener ) Pause the tweener and fire the OnPause event.
Tween.Tweener.Play( tweener ) Unpause the tweener and fire the OnPlay event.
Tween.Tweener.Restart( tweener ) Completely restart the tweener.
Tween.Tweener.Update( tweener, deltaDuration ) Update the tweener's value based on the tweener's elapsed property.
Vector2.GetLength( vector ) Return the length of the vector.
Vector2.GetSqrLength( vector ) Return the squared length of the vector.
Vector2.New( x, y ) Creates a new Vector2 intance.
Vector2.Normalize( vector ) Normalize the provided vector in place (makes its length equal to 1).
Vector2.Normalized( vector ) Return a copy of the provided vector, normalized.
Vector2.ToPixel( vector, camera ) Make sure that the components of the provided Vector2 are numbers and in pixel, instead of strings or in percentage or relative to the screensize.
Vector2.ToString( vector ) Returns a string representation of the vector's component's values.
Vector2.__add( a, b ) Allow to add two Vector2 by using the + operator.
Vector2.__div( a, b ) Allow to divide two Vector2 or a Vector2 and a number by using the / operator.
Vector2.__eq( a, b ) Allow to check for the equality between two Vector2 using the == comparison operator.
Vector2.__mul( a, b ) Allow to multiply two Vector2 or a Vector2 and a number by using the * operator.
Vector2.__pow( vector, exp ) Allow to raise a Vector2 to a power using the ^ operator.
Vector2.__sub( a, b ) Allow to substract two Vector2 by using the - operator.
Vector2.__unm( vector ) Allow to inverse a vector2 using the - operator.
Vector3.GetLength( vector ) Returns the length of the provided vector
Vector3.GetSqrLength( vector ) Return the squared length of the vector.
Vector3.New( x, y, z, z2 ) Returns a new Vector3.
Vector3.ToString( vector ) Returns a string representation of the vector's component's values.
error( message, doNotPrintStacktrace ) Print the stackTrace unless told otherwise then the provided error in the console.
math.clamp( value, min, max ) Return the value clamped between min and max.
math.isinteger( number ) Tell whether the provided number is an integer.
math.lerp( a, b, factor, easing ) Returns the value resulting of the linear interpolation between value a and b by the specified factor.
math.round( value, decimal ) Round the value to the closest integer or decimal.
math.truncate( value, decimal ) Trucate the value to the provided decimal.
math.warpangle( angle ) Wrap the provided angle between -180 and 180.
string.endswith( s, chunk ) Tell whether the provided string ends by the provided chunk or not.
string.fixcase( s, set ) Make sure that the case of the provided string is correct by checking it against the values in the provided set.
string.lcfirst( s ) Turn the first letter of the string lowercase.
string.reverse( s ) Reverse the order of the characters in a string ("abcd" becomes "dcba").
string.split( s, delimiter, delimiterIsPattern ) Some Lua functions are overridden here with some Daneel-specific stuffs
string.split( s, delimiter, delimiterIsPattern ) Some Lua functions are overridden here with some Daneel-specific stuffs
string.startswith( s, chunk ) Tell whether the provided string begins by the provided chunk or not.
string.tocolor( sColor ) Convert a string representation of a color component's values to a Color object.
string.totable( s ) Turn a string into a table, one character per index.
string.tovector( sVector ) Convert a string representation of a vector component's values to a Vector3 or a Vector2.
string.trim( s ) Removes the white spaces at the beginning and the end of the provided string.
string.trimend( s ) Removes the white spaces at the end of the provided string.
string.trimstart( s ) Removes the white spaces at the beginning of the provided string.
string.ucfirst( s ) Turn the first letter of the string uppercase.
table.combine( keys, values ) Create an associative table with the provided keys and values tables.
table.containsvalue( t, value, ignoreCase ) Tell whether the provided value is found within the provided table.
table.copy( t, recursive ) Return a copy of the provided table.
table.getkey( t, value ) Get the key associated with the first occurrence of the provided value.
table.getkeys( t ) Return all the keys of the provided table.
table.getlength( t, keyType ) Returns the length of a table, which is the numbers of keys of the provided type (or of any type), for which the value is not nil.
table.getvalue( t, keys ) Safely search several levels down inside nested tables.
table.getvalues( t ) Return all the values of the provided table.
table.havesamecontent( table1, table2 ) Compare table1 and table2.
table.insertonce( t, index, value ) Insert the provided value at the end of the provided table (or at the provided index) but only if the value is not already found in the table.
table.isarray( t, strict ) Tell whether he provided table is an array (has only integer keys).
table.merge( ..., recursive ) Merge two or more tables into one new table.
table.mergein( ..., recursive ) Merge two or more tables in place, into the first provided table.
table.print( t ) Print all key/value pairs within the provided table.
table.printr( t, maxLevel, reprint, currentLevel ) Recursively print all key/value pairs within the provided table.
table.reindex( t ) Turn the provided table (with only integer keys) in a proper sequence (with consecutive integer key beginning at 1).
table.removevalue( t, value, maxRemoveCount ) Remove the provided value from the provided table.
table.reverse( t ) Reverse the order of the provided table's values.
table.setvalue( t, keys, value ) Safely set a value several levels down inside nested tables.
table.shift( t, returnKey ) Remove and returns the first value found in the table.
table.sortby( t, property, orderBy ) Sort a list of table using one of the tables property as criteria.
tonumber2( data ) A more flexible version of tonumber().

Asset.Get( assetPath, assetType, errorIfAssetNotFound )

Alias of CraftStudio.FindAsset( assetPath[, assetType] ). Get the asset of the specified name and type. The first argument may be an asset object, so that you can check if a variable was an asset object or name (and get the corresponding object).

Parameters: Return value:

Asset.GetId( asset )

Returns the asset's internal unique identifier.

Parameters: Return value:

Asset.GetName( asset )

Returns the name of the provided asset.

Parameters: Return value:

Asset.GetPath( asset )

Returns the path of the provided asset. Alias of Map.GetPathInPackage().

Parameters: Return value:

Camera.GetBaseDistance( camera )

Returns the perspective camera's base distance. The base distance is the distance from the camera at which 1 scene unit has the size of the smallest side of the screen. Only works for perspective cameras. Returns nil for orthographic cameras.

Parameters: Return value:

Camera.GetFOV( camera )

Returns the FOV of the provided perspective camera (rounded to the second digit after the coma).

Parameters: Return value:

Camera.GetPixelsToUnits( camera )

Returns the pixels to scene units factor.

Parameters: Return value:

Camera.GetUnitsToPixels( camera )

Returns the scene units to pixels factor.

Parameters: Return value:

Camera.IsPositionInFrustum( camera, position )

Tell whether the provided position is inside the camera's frustum.

Parameters: Return value:

Camera.Project( camera, position )

Projects a 3D space position to a 2D screen position.

Parameters: Return value:

Camera.Set( camera, params )

Apply the content of the params argument to the provided camera.

Parameters:

Camera.SetProjectionMode( camera, projectionMode )

Sets the camera projection mode.

Parameters:

Camera.WorldToScreenPoint( camera, position )

Translate a position in the scene to an on-screen position. The Z component of the returned Vector3 represent the distance from the camera to the position's plane. It's inferior to zero when the position is in front of the camera. Note that when the object is behind the camera, the returned screen coordinates are not the same as the ones given by Camera.Project().

Parameters: Return value:

Color.GetHSV( color )

Return the Hue, Saturation and Value of the provided color.

Parameters: Return values:
  1. (number) The hue of the color (between 0 and 1).
  2. (number) The saturation of the color (between 0 and 1).
  3. (number) The value of the color (between 0 and 1).

Color.GetHex( color )

Return the color's hexadecimal representation. Only return the 6 characters of the component's values, so you may want to prefix it with "#" or "0x" yourself.

Parameters: Return value:

Color.GetName( color )

Return the name of the color, provided it can be found in the `Color.colorsByName` object.

Parameters: Return value:

Color.GetRandom( pattern )

Returns a random color, optional of the provided pattern.

Parameters: Return value:

Color.HexToRGB( hex )

Convert an hexadecimal color into its RGB components.

Parameters: Return values:
  1. (number) The color's red component.
  2. (number) The color's green component.
  3. (number) The color's blue component.

Color.New( r, g, b )

Create a new color object.

Parameters: Return value:

Color.RGBToHex( r, g, b )

Return the hexadecimal representation of the provided color or r, g, b components. Only return the 6 characters of the component's values, so you may want to prefix it with "#" or "0x" yourself.

Parameters:

Color.SetHex( color, hex )

Set the color from an hexadecimal representation.

Parameters:

Color.ToArray( color )

Convert the provided color object to an array. Allow to loop on the color's components in order.

Parameters: Return value:

Color.ToRGB( color )

Convert the provided color object to a table with "r", "g", "b" keys. Allow to loop on the color's components.

Parameters: Return value:

Color.ToString( color )

Returns a string representation of the color's components, each component being separated y a space. ie: For a color { 10, 250, 128 }, the returned string would be "10 250 128". Such string can be converted back to a color object with string.tocolor()

Parameters: Return value:

Color.ToVector3( color )

Convert the provided color object to a Vector3. This can be needed because the component's values of a Vector3 are not clamped between 0 and 255.

Parameters: Return value:

Color.__add( a, b )

Allow to add two Color objects by using the + operator. Ie : color1 + color2

Parameters: Return value:

Color.__div( a, b )

Allow to divide two Color objects or a Color object and a number by using the / operator.

Parameters: Return value:

Color.__eq( a, b )

Allow to check for the equality between two Color objects using the == comparison operator.

Parameters: Return value:

Color.__mul( a, b )

Allow to multiply two Color object or a Color object and a number by using the * operator.

Parameters: Return value:

Color.__sub( a, b )

Allow to subtract two Color objects by using the - operator. Ie : color1 - color2

Parameters: Return value:

Component.Destroy( component )

Destroy the provided component, removing it from the game object. Note that the component is removed only at the end of the current frame.

Parameters:

Component.GetId( component )

Returns the component's internal unique identifier.

Parameters: Return value:

Component.Set( component, params )

Apply the content of the params argument to the provided component.

Parameters:

CraftStudio.Destroy( object )

Removes the specified game object (and all of its descendants) or the specified component from its game object. You can also optionally specify a dynamically loaded asset for unloading (See Map.LoadFromPackage ). Sets the 'isDestroyed' property to 'true' and fires the 'OnDestroy' event on the object.

Parameters:

CraftStudio.Input.GetMouseDelta( )

Return the mouse delta (the variation of position) since the last frame. Positive x is right, positive y is bottom.

Return value:

CraftStudio.Input.GetMousePosition( )

Return the mouse position on screen coordinates {x, y}

Return value:

CraftStudio.Input.ToggleMouseLock( )

Toggle the locked state of the mouse, which can be accessed via the CraftStudio.Input.isMouseLocked property.


CraftStudio.LoadScene( sceneNameOrAsset )

Schedules loading the specified scene after the current tick (1/60th of a second) has completed. When the new scene is loaded, all of the current scene's game objects will be removed. Calling this function doesn't immediately stops the calling function. As such, you might want to add a return statement afterwards.

Parameters:

CraftStudio.Screen.GetSize( )

Return the size of the screen, in pixels.

Return value:

CraftStudio.Screen.SetSize( x, y )

Sets the size of the screen, in pixels.

Parameters:

CraftStudio.Storage.Load( identifier, defaultValue, callback )

Load data stored locally on the computer under the provided identifier. The load operation may not be instantaneous.

Parameters:

CraftStudio.Storage.Save( identifier, data, callback )

Store locally on the computer the provided data under the provided identifier.

Parameters:

Daneel.Debug.CheckArgType( argument, argumentName, expectedArgumentTypes, p_errorHead )

Check the provided argument's type against the provided type(s) and display error if they don't match.

Parameters: Return value:

Daneel.Debug.CheckArgValue( argument, argumentName, expectedArgumentValues, p_errorHead, defaultValue )

Check if the provided argument's value is in the provided expected value(s). When that's not the case, return the value of the 'defaultValue' argument, or throws an error when it is nil. Arguments of type string are considered case-insensitive. The case will be corrected but no error will be thrown. When 'expectedArgumentValues' is of type table, it is always considered as a table of several expected values.

Parameters: Return value:

Daneel.Debug.CheckOptionalArgType( argument, argumentName, expectedArgumentTypes, p_errorHead, defaultValue )

If the provided argument is not nil, check the provided argument's type against the provided type(s) and display error if they don't match.

Parameters: Return value:

Daneel.Debug.Disable( info )

Disable the debug from this point onward.

Parameters:

Daneel.Debug.GetNameFromValue( value )

Returns the name as a string of the global variable (including nested tables) whose value is provided. This only works if the value of the variable is a table or a function. When the variable is nested in one or several tables (like GUI.Hud), it must have been set in the 'objects' table in the config.

Parameters: Return value:

Daneel.Debug.RegisterFunction( name, argsData )

Overload a function to call debug functions before and after it is itself called. Do not call before Daneel is loaded as it won't run even if debug is enabled in the user config.

Parameters:

Daneel.Debug.RegisterObject( object )

Register all functions of an object to be included in the stacktrace. The following function name are always excluded from the stacktrace and debug : "Load", "DefaultConfig", "UserConfig", "Awake", "Start", "Update", "New", "inner", "GetId", "GetName" Plus function names that begins by "__" or "o".

Parameters:

Daneel.Debug.RegisterScript( script )

Register all functions of a scripted behavior to be included in the stacktrace. Within a script, the 'Behavior' variable is the script asset.

Parameters:

Daneel.Debug.StackTrace.BeginFunction( functionName, ... )

Register a function call in the stack trace.

Parameters:

Daneel.Debug.StackTrace.EndFunction( )

Closes a successful function call, removing it from the stacktrace.


Daneel.Debug.StackTrace.Print( )

Prints the StackTrace.


Daneel.Debug.ToRawString( data )

Bypass the __tostring() function that may exists on the data's metatable.

Parameters: Return value:

Daneel.Debug.Try( _function )

Allow to test out a piece of code without killing the script if the code throws an error. If the code throw an error, it will be printed in the Runtime Report but it won't kill the script that calls Daneel.Debug.Try(). Does not protect against exceptions thrown by CraftStudio.

Parameters: Return value:

Daneel.DefaultConfig( )

Config, loading


Daneel.Event.AddEventListener( object, eventName, listener )

Add a listener function for the specified local event on this object.

Parameters:

Daneel.Event.Fire( object, eventName, ... )

Fire the provided event at the provided object or the one that listen to it, transmitting along all subsequent arguments if some exists.
Allowed set of arguments are :
(eventName[, ...])
(object, eventName[, ...])


Parameters:

Daneel.Event.Listen( eventName, functionOrObject, isPersistent )

Make the provided function or object listen to the provided event(s). The function will be called whenever the provided event will be fired.

Parameters:

Daneel.Event.RemoveEventListener( object, eventName, listener )

Remove the specified listener for the specified local event on this object

Parameters:

Daneel.Event.StopListen( eventName, functionOrObject )

Make the provided function or object to stop listen to the provided event(s).

Parameters:

Daneel.Utilities.AllowDynamicGettersAndSetters( Object, ancestors )

Allow to call getters and setters as if they were variable on the instance of the provided object. The instances are tables that have the provided object as metatable. Optionally allow to search in a ancestry of objects.

Parameters:

Daneel.Utilities.ButtonExists( buttonName )

Tell whether the provided button name exists amongst the Game Controls, or not. If the button name does not exists, it will print an error in the Runtime Report but it won't kill the script that called the function. CS.Input.ButtonExists is an alias of Daneel.Utilities.ButtonExists.

Parameters: Return value:

Daneel.Utilities.GetId( object )

Returns an integer greater than 0 and incremented by 1 from the last time the function was called. If an object is provided, returns the object's id (if no id is found, it is set).

Parameters: Return value:

Daneel.Utilities.ReplaceInString( string, replacements )

Replace placeholders in the provided string with their corresponding provided replacements. The placeholders are any piece of string prefixed by a semicolon.

Parameters: Return value:

Draw.CircleRenderer.Draw( circle )

Draw the circle renderer. Updates the game object based on the circle renderer's properties. Fires the OnDraw event at the circle renderer.

Parameters:

Draw.CircleRenderer.GetModel( circle )

Returns the circle renderer's segment's model.

Parameters: Return value:

Draw.CircleRenderer.GetOpacity( circle )

Returns the circle renderer's segments' opacity.

Parameters: Return value:

Draw.CircleRenderer.GetRadius( circle )

Returns the circle renderer's radius.

Parameters: Return value:

Draw.CircleRenderer.GetSegmentCount( circle )

Returns the circle renderer's number of segments.

Parameters: Return value:

Draw.CircleRenderer.GetWidth( circle )

Returns the circle renderer's segment's width (and height).

Parameters: Return value:

Draw.CircleRenderer.New( gameObject, params )

Creates a new circle renderer component.

Parameters: Return value:

Draw.CircleRenderer.Set( circle, params )

Apply the content of the params argument to the provided circle renderer. Overwrite Component.Set().

Parameters:

Draw.CircleRenderer.SetModel( circle, model )

Sets the circle renderer segment's model.

Parameters:

Draw.CircleRenderer.SetOpacity( circle, opacity )

Sets the circle renderer segments' opacity.

Parameters:

Draw.CircleRenderer.SetRadius( circle, radius, draw )

Sets the circle renderer's radius.

Parameters:

Draw.CircleRenderer.SetSegmentCount( circle, count, draw )

Sets the circle renderer's segment count.

Parameters:

Draw.CircleRenderer.SetWidth( circle, width )

Sets the circle renderer segment's width.

Parameters:

Draw.LineRenderer.Draw( line )

Draw the line renderer. Updates the game object based on the line renderer's properties. Fires the OnDraw event on the line renderer.

Parameters:

Draw.LineRenderer.GetDirection( line )

Returns the line renderer's direction.

Parameters: Return value:

Draw.LineRenderer.GetEndPosition( line )

Returns the line renderer's end position.

Parameters: Return value:

Draw.LineRenderer.GetLength( line )

Returns the line renderer's length.

Parameters: Return value:

Draw.LineRenderer.GetWidth( line )

Returns the line renderer's width.

Parameters: Return value:

Draw.LineRenderer.New( gameObject, params )

Creates a new LineRenderer component.

Parameters: Return value:

Draw.LineRenderer.Set( line, params )

Apply the content of the params argument to the provided line renderer. Overwrite Component.Set().

Parameters:

Draw.LineRenderer.SetDirection( line, direction, useDirectionAsLength, draw )

Set the line renderer's direction. It also updates line renderer's end position.

Parameters:

Draw.LineRenderer.SetEndPosition( line, endPosition, draw )

Set the line renderer's end position. It also updates the line renderer's direction and length.

Parameters:

Draw.LineRenderer.SetLength( line, length, draw )

Set the line renderer's length. It also updates line renderer's end position.

Parameters:

Draw.LineRenderer.SetWidth( line, width, draw )

Set the line renderer's width (and height).

Parameters:

GUI.Hud.CreateOriginGO( gameObject )

Creates a "Hud Origin" child used for positioning hud components.

Parameters:

GUI.Hud.GetLayer( hud )

Get the gameObject's layer.

Parameters: Return value:

GUI.Hud.GetLocalLayer( hud )

Get the gameObject's local layer.

Parameters: Return value:

GUI.Hud.GetLocalPosition( hud )

Get the local position (relative to its parent) of the gameObject on screen.

Parameters: Return value:

GUI.Hud.GetPosition( hud )

Get the position of the provided hud on the screen.

Parameters: Return value:

GUI.Hud.New( gameObject, params )

Creates a new Hud component instance.

Parameters: Return value:

GUI.Hud.SetLayer( hud, layer )

Set the gameObject's layer.

Parameters:

GUI.Hud.SetLocalLayer( hud, layer )

Set the huds's local layer.

Parameters:

GUI.Hud.SetLocalPosition( hud, position )

Sets the local position (relative to its parent) of the gameObject on screen .

Parameters:

GUI.Hud.SetPosition( hud, position )

Sets the position of the gameObject on screen. With the top-left corner of the screen as origin.

Parameters:

GUI.Input.Focus( input, focus )

Set the focused state of the input.

Parameters:

GUI.Input.New( gameObject, params )

Creates a new GUI.Input.

Parameters: Return value:

GUI.Input.Update( input, text, replaceText )

Update the text of the input.

Parameters:

GUI.Input.UpdateCursor( input )

Update the position and opacity of the input's cursor.

Parameters:

GUI.ProgressBar.GetHeight( progressBar )

Get the height of the progress bar (the local scale's y component).

Parameters: Return value:

GUI.ProgressBar.GetValue( progressBar, getAsPercentage )

Get the current value of the progress bar.

Parameters: Return value:

GUI.ProgressBar.New( gameObject, params )

Creates a new GUI.ProgressBar.

Parameters: Return value:

GUI.ProgressBar.Set( progressBar, params )

Apply the content of the params argument to the provided progressBar. Overwrite Component.Set() from CraftStudio module.

Parameters:

GUI.ProgressBar.SetHeight( progressBar, height )

Set the height of the progress bar.

Parameters:

GUI.ProgressBar.SetValue( progressBar, value )

Set the value of the progress bar, adjusting its length. Fires the 'OnUpdate' event.

Parameters:

GUI.ProgressBar.UpdateValue( progressBar, value, fireEvent )

Set the value of the progress bar, adjusting its length. Does the same things as SetProgress() by does it faster. Unlike SetProgress(), does not fire the 'OnUpdate' event by default. Should be used when the value is updated regularly (ie : from a Behavior:Update() function).

Parameters:

GUI.Slider.GetValue( slider, getAsPercentage )

Get the current slider's value.

Parameters: Return value:

GUI.Slider.New( gameObject, params )

Creates a new GUI.Slider.

Parameters: Return value:

GUI.Slider.Set( slider, params )

Apply the content of the params argument to the provided slider. Overwrite Component.Set() from the core.

Parameters:

GUI.Slider.SetValue( slider, value )

Set the value of the slider, adjusting its position.

Parameters:

GUI.TextArea.AddLine( textArea, line, prepend )

Add a line to the text area's text.

Parameters:

GUI.TextArea.GetAlignment( textArea )

Get the component's horizontal alignment.

Parameters: Return value:

GUI.TextArea.GetAreaWidth( textArea )

Get the component's area width.

Parameters: Return value:

GUI.TextArea.GetFont( textArea )

Get the component's font used to render the text.

Parameters: Return value:

GUI.TextArea.GetLineHeight( textArea )

Get the component's line height.

Parameters: Return value:

GUI.TextArea.GetNewLine( textArea )

Get the component's newLine string.

Parameters: Return value:

GUI.TextArea.GetOpacity( textArea )

Get the component's opacity.

Parameters: Return value:

GUI.TextArea.GetText( textArea )

Get the component's text.

Parameters: Return value:

GUI.TextArea.GetVerticalAlignment( textArea )

Get the component's vertical alignment property.

Parameters: Return value:

GUI.TextArea.GetWordWrap( textArea )

Get the component's wordWrap property.

Parameters: Return value:

GUI.TextArea.New( gameObject, params )

Creates a new TextArea component.

Parameters: Return value:

GUI.TextArea.Set( textArea, params )

Apply the content of the params argument to the provided textArea. Overwrite Component.Set() from the core.

Parameters:

GUI.TextArea.SetAlignment( textArea, alignment )

Set the component's alignment. Works like a TextRenderer alignment.

Parameters:

GUI.TextArea.SetAreaWidth( textArea, areaWidth )

Set the component's area width (maximum line length). Must be strictly positive to have an effect. Set as a negative value, 0 or nil to remove the limitation.

Parameters:

GUI.TextArea.SetFont( textArea, font )

Set the component's font used to renderer the text.

Parameters:

GUI.TextArea.SetLineHeight( textArea, lineHeight )

Set the component's line height.

Parameters:

GUI.TextArea.SetNewLine( textArea, newLine )

Set the component's newLine string used by SetText() to split the input text in several lines.

Parameters:

GUI.TextArea.SetOpacity( textArea, opacity )

Set the component's opacity.

Parameters:

GUI.TextArea.SetText( textArea, text )

Set the component's text.

Parameters:

GUI.TextArea.SetVerticalAlignment( textArea, verticalAlignment )

Set the component's vertical alignment.

Parameters:

GUI.TextArea.SetWordWrap( textArea, wordWrap )

Set the component's wordWrap property. Define what happens when the lines are longer then the area width.

Parameters:

GUI.ToPixel( value, screenSide, camera )

Convert the provided value (a length) in a number expressed in screen pixel. The provided value may be suffixed with "px" or be expressed in percentage (ie: "10%") or be relative (ie: "s" or "s-10") to the specified screen side size (in which case the 'screenSide' argument is mandatory).

Parameters: Return value:

GUI.ToSceneUnit( value, camera )

Convert the provided value (a length) in a number expressed in scene unit. The provided value may be suffixed with "px" (pixels) or "u" (scene units).

Parameters: Return value:

GUI.Toggle.Check( toggle, state, forceUpdate )

Check or uncheck the provided toggle and fire the OnUpdate event. You can get the toggle's state via toggle.isChecked.

Parameters:

GUI.Toggle.GetGroup( toggle )

Get the toggle's group.

Parameters: Return value:

GUI.Toggle.GetText( toggle )

Get the provided toggle's text. Actually get the text of the TextRenderer component on the same gameObject but without the check mark.

Parameters: Return value:

GUI.Toggle.New( gameObject, params )

Creates a new Toggle component.

Parameters: Return value:

GUI.Toggle.Set( toggle, params )

Apply the content of the params argument to the provided toggle. Overwrite Component.Set() from Daneel's CraftStudio file.

Parameters:

GUI.Toggle.SetGroup( toggle, group )

Set the toggle's group. If the toggle was already in a group it will be removed from it.

Parameters:

GUI.Toggle.SetText( toggle, text )

Set the provided toggle's text. Actually set the text of the TextRenderer component on the same gameObject, but add the correct check mark in front of the provided text.

Parameters:

GameObject.AddComponent( gameObject, componentType, params )

Add a component to the game object and optionally initialize it.

Parameters: Return value:

GameObject.AddEventListener( gameObject, eventName, listener )

Add a listener function for the specified local event on this game object. Alias of Daneel.Event.AddEventListener().

Parameters:

GameObject.AddTag( gameObject, tag )

Add the provided tag(s) to the provided game object.

Parameters:

GameObject.Animate( gameObject, property, endValue, duration, onCompleteCallback, params )

Creates an animation (a tweener) with the provided parameters.

Parameters: Return value:

GameObject.Destroy( gameObject )

Destroy the game object at the end of this frame.

Parameters:

GameObject.Display( gameObject, value, forceUseLocalPosition )

Display or hide the game object. Act on the renderer's opacity or the transform's local position. Sets the "isDisplayed" property to true or false and fire the "OnDisplay" event on the game object.

Parameters:

GameObject.FireEvent( gameObject, eventName, ... )

Fire an event at the provided game object.

Parameters:

GameObject.Get( name, errorIfGameObjectNotFound )

Alias of CraftStudio.FindGameObject(name). Get the first game object with the provided name.

Parameters: Return value:

GameObject.GetChild( gameObject, name, recursive )

Alias of GameObject.FindChild(). Find the first game object's child with the provided name. If the name is not provided, it returns the first child.

Parameters: Return value:

GameObject.GetChildren( gameObject, recursive, includeSelf )

Get all descendants of the game object.

Parameters: Return value:

GameObject.GetComponent( gameObject, componentType )

Get the first component of the provided type attached to the game object.

Parameters: Return value:

GameObject.GetId( gameObject )

Returns the game object's internal unique identifier.

Parameters: Return value:

GameObject.GetInAncestors( gameObject, searchFunction )

Search the ancestors of the provided game object. It returns the game object that match the condition in the search function. The search function receive a game object as the only argument. The search function must return true in order for GetInAncestors() to return the searched game object.

Parameters: Return value:

GameObject.GetScriptedBehavior( gameObject, scriptNameOrAsset )

Get the provided scripted behavior instance attached to the game object.

Parameters: Return value:

GameObject.GetTags( gameObject )

Returns the tag(s) of the provided game object.

Parameters: Return value:

GameObject.GetWithTag( tag )

Returns the game object(s) that have all the provided tag(s).

Parameters: Return value:

GameObject.HasTag( gameObject, tag, atLeastOneTag )

Tell whether the provided game object has all (or at least one of) the provided tag(s).

Parameters: Return value:

GameObject.Instantiate( name, sceneNameOrAsset, params )

Create a new game object with the content of the provided scene and optionally initialize it.

Parameters: Return value:

GameObject.New( name, params )

Create a new game object and optionally initialize it.

Parameters: Return value:

GameObject.RemoveEventListener( gameObject, eventName, listener )

Remove the specified listener for the specified local event on this game object

Parameters:

GameObject.RemoveTag( gameObject, tag )

Remove the provided tag(s) from the provided game object. If the 'tag' argument is not provided, all tag of the game object will be removed.

Parameters:

GameObject.SendMessage( gameObject, functionName, data )

Tries to call a method with the provided name on all the scriptedBehaviors attached to the game object. The data argument can be nil or a table you want the method to receive as its first (and only) argument. If none of the scripteBehaviors attached to the game object or its children have a method matching the provided name, nothing happens.

Parameters:

GameObject.Set( gameObject, params )

Apply the content of the params argument to the provided game object.

Parameters:

GameObject.SetParent( gameObject, parentNameOrInstance, keepLocalTransform )

Set the game object's parent. Optionaly carry over the game object's local transform instead of the global one.

Parameters:

Lang.Get( key, replacements )

Get the localized line identified by the provided key.

Parameters: Return value:

Lang.RegisterForUpdate( gameObject, key, replacements )

Register a game object to update its text renderer whenever the language will be updated by Lang.Update().

Parameters:

Lang.Update( language )

Update the current language and the text of all game objects that have registered via Lang.RegisterForUpdate().
Fire the OnLangUpdate event.

Parameters:

Map.GetBlockIDAt( map, x, y, z )

Returns A block ID between 0-254 if a block exists at the given location (all valid block IDs are in the range 0-254), otherwise f there is no block at the given location then it will return Map.EmptyBlockID (which has a value of 255).

Parameters: Return value:

Map.GetBlockOrientationAt( map, x, y, z )

Returns The block orientation of the block at the specified location, otherwise if there is no block at the given location it will return Map.BlockOrientation.North.

Parameters: Return value:

Map.SetBlockAt( map, x, y, z, id, orientation )

Sets a block's ID and block orientation at the given location on the map.

Parameters:

MapRenderer.LoadNewMap( mapRenderer, callback )

Dynamically loads a new version of the provided map renderer's map and sets it as the map renderer new map.

Parameters:

MapRenderer.Set( mapRenderer, params )

Apply the content of the params argument to the provided map renderer.

Parameters:

MapRenderer.SetMap( mapRenderer, mapNameOrAsset, replaceTileSet )

Attach the provided map to the provided map renderer.

Parameters:

MapRenderer.SetTileSet( mapRenderer, tileSetNameOrAsset )

Set the specified tileSet for the mapRenderer's map.

Parameters:

ModelRenderer.GetColor( modelRenderer )

Get the color of the provided model renderer.

Parameters: Return value:

ModelRenderer.Set( modelRenderer, params )

Apply the content of the params argument to the provided model renderer.

Parameters:

ModelRenderer.SetAnimation( modelRenderer, animationNameOrAsset )

Set the specified animation for the modelRenderer's current model.

Parameters:

ModelRenderer.SetColor( modelRenderer, color )

Set the color of the provided model renderer.

Parameters:

ModelRenderer.SetModel( modelRenderer, modelNameOrAsset )

Attach the provided model to the provided modelRenderer.

Parameters:

MouseInput.GetTags( mouseInput )

Return the tag(s) of the game objects the component works with.

Parameters: Return value:

MouseInput.New( gameObject, params )

Create a new MouseInput component.

Parameters: Return value:

MouseInput.SetTags( mouseInput, tags )

Set tag(s) of the game objects the component works with.

Parameters:

MouseInput.Update( mouseInput )

Update the specified MouseInput component or update all components when no argument is passed. When the component is specified, the update is forced. It happens even if the mouse doesn't move and no button input happens.

Parameters:

Ray.Cast( ray, gameObjects, sortByDistance )

Check the collision of the ray against the provided set of game objects.

Parameters: Return value:

Ray.IntersectsGameObject( ray, gameObjectNameOrInstance )

Check if the ray intersects the specified game object.

Parameters: Return value:

RaycastHit.New( params )

Create a new RaycastHit

Parameters: Return value:

Scene.Append( sceneNameOrAsset, parentNameOrInstance )

Alias of CraftStudio.AppendScene(). Appends the specified scene to the game by instantiating all of its game objects. Contrary to CraftStudio.LoadScene, this doesn't unload the current scene nor waits for the next tick: it happens right away. You can optionally specify a parent game object which will be used as a root for adding all game objects. Returns the game object appended if there was only one root game object in the provided scene.

Parameters: Return value:

Scene.Load( sceneNameOrAsset )

Alias of CraftStudio.LoadScene(). Schedules loading the specified scene after the current tick (frame) (1/60th of a second) has completed. When the new scene is loaded, all of the current scene's game objects will be removed. Calling this function doesn't immediately stops the calling function. As such, you might want to add a return statement afterwards.

Parameters:

Sound.Play( soundAssetOrPath, volume, pitch, pan )

Play the specified sound.

Parameters:

TextRenderer.GetColor( textRenderer )

Get the color of the provided text renderer.

Parameters: Return value:

TextRenderer.SetAlignment( textRenderer, alignment )

Set the text's alignment.

Parameters:

TextRenderer.SetColor( textRenderer, color )

Set the color of the provided text renderer.

Parameters:

TextRenderer.SetFont( textRenderer, fontNameOrAsset )

Set the provided font to the provided text renderer.

Parameters:

TextRenderer.SetTextWidth( textRenderer, width )

Update the game object's scale to make the text appear the provided width.

Parameters:

Transform.GetScale( transform )

Get the transform's global scale.

Parameters: Return value:

Transform.LocalToWorld( transform, position )

Transform a position local to this transform to a global position.

Parameters: Return value:

Transform.SetLocalScale( transform, scale )

Set the transform's local scale.

Parameters:

Transform.SetScale( transform, scale )

Set the transform's global scale.

Parameters:

Transform.WorldToLocal( transform, position )

Transform a global position to a position local to this transform.

Parameters: Return value:

Trigger.GetGameObjectsInRange( trigger )

Get the gameObjects that are within range of that trigger.

Parameters: Return value:

Trigger.GetRange( trigger )

Get the range of the trigger.

Parameters: Return value:

Trigger.GetTags( trigger )

Return the tag(s) of the game objects the component works with.

Parameters: Return value:

Trigger.GetUpdateInterval( trigger )

Get the interval (in frames) at which the trigger is automatically updated.

Parameters: Return value:

Trigger.IsGameObjectInRange( trigger, gameObject, triggerPosition )

Tell whether the provided game object is in range of the trigger.

Parameters: Return value:

Trigger.New( gameObject, params )

Create a new Trigger component.

Parameters: Return value:

Trigger.SetRange( trigger, range )

Set the range of the trigger.

Parameters:

Trigger.SetTags( trigger, tags )

Set tag(s) of the game objects the component works with.

Parameters:

Trigger.SetUpdateInterval( trigger, updateInterval )

Set the interval (in frames) at which the trigger is automatically updated. A value < 1 will prevent the trigger to be automatically updated.

Parameters:

Tween.Timer.New( duration, callback, isInfiniteLoop, params )

Creates a new tweener via one of the two allowed constructors :
Timer.New(duration, OnCompleteCallback[, params])
Timer.New(duration, OnLoopCompleteCallback, true[, params])


Parameters: Return value:

Tween.Tweener.Complete( tweener )

Complete the tweener fire the OnComple event.

Parameters:

Tween.Tweener.Destroy( tweener )

Destroy the tweener.

Parameters:

Tween.Tweener.New( target, property, endValue, duration, onCompleteCallback, params )

Creates a new tweener via one of the three allowed constructors :
Tweener.New(target, property, endValue, duration[, params])
Tweener.New(startValue, endValue, duration[, params])
Tweener.New(params)

Parameters: Return value:

Tween.Tweener.Pause( tweener )

Pause the tweener and fire the OnPause event.

Parameters:

Tween.Tweener.Play( tweener )

Unpause the tweener and fire the OnPlay event.

Parameters:

Tween.Tweener.Restart( tweener )

Completely restart the tweener.

Parameters:

Tween.Tweener.Update( tweener, deltaDuration )

Update the tweener's value based on the tweener's elapsed property. Fire the OnUpdate event. This allows the tweener to fast-forward to a certain time.

Parameters:

Vector2.GetLength( vector )

Return the length of the vector.

Parameters: Return value:

Vector2.GetSqrLength( vector )

Return the squared length of the vector.

Parameters: Return value:

Vector2.New( x, y )

Creates a new Vector2 intance.

Parameters: Return value:

Vector2.Normalize( vector )

Normalize the provided vector in place (makes its length equal to 1).

Parameters:

Vector2.Normalized( vector )

Return a copy of the provided vector, normalized.

Parameters: Return value:

Vector2.ToPixel( vector, camera )

Make sure that the components of the provided Vector2 are numbers and in pixel, instead of strings or in percentage or relative to the screensize.

Parameters: Return value:

Vector2.ToString( vector )

Returns a string representation of the vector's component's values. ie: For a vector {-6.5,10}, the returned string would be "-6.5 10". Such string can be converted back to a vector with string.tovector()

Parameters: Return value:

Vector2.__add( a, b )

Allow to add two Vector2 by using the + operator. Ie : vector1 + vector2

Parameters: Return value:

Vector2.__div( a, b )

Allow to divide two Vector2 or a Vector2 and a number by using the / operator.

Parameters: Return value:

Vector2.__eq( a, b )

Allow to check for the equality between two Vector2 using the == comparison operator.

Parameters: Return value:

Vector2.__mul( a, b )

Allow to multiply two Vector2 or a Vector2 and a number by using the * operator.

Parameters: Return value:

Vector2.__pow( vector, exp )

Allow to raise a Vector2 to a power using the ^ operator.

Parameters: Return value:

Vector2.__sub( a, b )

Allow to substract two Vector2 by using the - operator. Ie : vector1 - vector2

Parameters: Return value:

Vector2.__unm( vector )

Allow to inverse a vector2 using the - operator.

Parameters: Return value:

Vector3.GetLength( vector )

Returns the length of the provided vector

Parameters: Return value:

Vector3.GetSqrLength( vector )

Return the squared length of the vector.

Parameters: Return value:

Vector3.New( x, y, z, z2 )

Returns a new Vector3.

Parameters:

Vector3.ToString( vector )

Returns a string representation of the vector's component's values. ie: For a vector {-6.5,10,2.1}, the returned string would be "-6.5 10 2.1". Such string can be converted back to a vector with string.tovector()

Parameters: Return value:

error( message, doNotPrintStacktrace )

Print the stackTrace unless told otherwise then the provided error in the console. Only exists when debug is enabled. When debug in disabled the built-in 'error(message)'' function exists instead.

Parameters:

math.clamp( value, min, max )

Return the value clamped between min and max.

Parameters: Return value:

math.isinteger( number )

Tell whether the provided number is an integer. That include numbers that have one or several zeros as decimals (1.0, 2.000, ...).

Parameters: Return value:

math.lerp( a, b, factor, easing )

Returns the value resulting of the linear interpolation between value a and b by the specified factor.

Parameters: Return value:

math.round( value, decimal )

Round the value to the closest integer or decimal.

Parameters: Return value:

math.truncate( value, decimal )

Trucate the value to the provided decimal.

Parameters: Return value:

math.warpangle( angle )

Wrap the provided angle between -180 and 180.

Parameters: Return value:

string.endswith( s, chunk )

Tell whether the provided string ends by the provided chunk or not.

Parameters: Return value:

string.fixcase( s, set )

Make sure that the case of the provided string is correct by checking it against the values in the provided set.

Parameters: Return value:

string.lcfirst( s )

Turn the first letter of the string lowercase.

Parameters: Return value:

string.reverse( s )

Reverse the order of the characters in a string ("abcd" becomes "dcba").

Parameters: Return value:

string.split( s, delimiter, delimiterIsPattern )

Some Lua functions are overridden here with some Daneel-specific stuffs

Parameters:

string.split( s, delimiter, delimiterIsPattern )

Some Lua functions are overridden here with some Daneel-specific stuffs

Parameters:

string.startswith( s, chunk )

Tell whether the provided string begins by the provided chunk or not.

Parameters: Return value:

string.tocolor( sColor )

Convert a string representation of a color component's values to a Color object. ie: For a string "10 250 128", the returned color would be { 10, 250, 128 }. Such string can be created from a Color with with Color.ToString()

Parameters: Return value:

string.totable( s )

Turn a string into a table, one character per index.

Parameters: Return value:

string.tovector( sVector )

Convert a string representation of a vector component's values to a Vector3 or a Vector2. ie: For a string "-6.5 10 2.1", the returned vector would be {-6.5, 10, 2.1}. Such string can be created from a vector2 or Vector3 with Vector2.ToString() or Vector3.ToString().

Parameters: Return value:

string.trim( s )

Removes the white spaces at the beginning and the end of the provided string.

Parameters: Return value:

string.trimend( s )

Removes the white spaces at the end of the provided string.

Parameters: Return value:

string.trimstart( s )

Removes the white spaces at the beginning of the provided string.

Parameters: Return value:

string.ucfirst( s )

Turn the first letter of the string uppercase.

Parameters: Return value:

table.combine( keys, values )

Create an associative table with the provided keys and values tables.

Parameters: Return value:

table.containsvalue( t, value, ignoreCase )

Tell whether the provided value is found within the provided table.

Parameters: Return value:

table.copy( t, recursive )

Return a copy of the provided table.

Parameters: Return value:

table.getkey( t, value )

Get the key associated with the first occurrence of the provided value.

Parameters: Return value:

table.getkeys( t )

Return all the keys of the provided table.

Parameters: Return value:

table.getlength( t, keyType )

Returns the length of a table, which is the numbers of keys of the provided type (or of any type), for which the value is not nil.

Parameters: Return value:

table.getvalue( t, keys )

Safely search several levels down inside nested tables. Just returns nil if the series of keys does not leads to a value.
Can also be used to check if a global variable exists if the table is _G.
Ie for this series of nested table : table1.table2.table3.fooBar
table.getvalue( table1, "table2.table3.fooBar" ) would return the value of the 'fooBar' key in the 'table3' table
table.getvalue( table1, "table2.table3" ) would return the value of 'table3'
table.getvalue( table1, "table2.table3.Foo" ) would return nil because the 'table3' has no 'Foo' key
table.getvalue( table1, "table2.Foo.Bar.Lorem.Ipsum" ) idem


Parameters: Return value:

table.getvalues( t )

Return all the values of the provided table.

Parameters: Return value:

table.havesamecontent( table1, table2 )

Compare table1 and table2. Returns true if they have the exact same keys which have the exact same values.

Parameters: Return value:

table.insertonce( t, index, value )

Insert the provided value at the end of the provided table (or at the provided index) but only if the value is not already found in the table.

Parameters: Return value:

table.isarray( t, strict )

Tell whether he provided table is an array (has only integer keys). Decimal numbers with only zeros after the coma are considered as integers.

Parameters: Return value:

table.merge( ..., recursive )

Merge two or more tables into one new table. Table as values with a metatable are considered as instances and are not recursively merged. When the tables are arrays, the integer keys are not overridden.

Parameters: Return value:

table.mergein( ..., recursive )

Merge two or more tables in place, into the first provided table. Table as values with a metatable are considered as instances and are not recursively merged. When the tables are arrays, the integer keys are not overridden.

Parameters: Return value:

table.print( t )

Print all key/value pairs within the provided table.

Parameters:

table.printr( t, maxLevel, reprint, currentLevel )

Recursively print all key/value pairs within the provided table. Fully prints the tables that have no metatable found as values.

Parameters:

table.reindex( t )

Turn the provided table (with only integer keys) in a proper sequence (with consecutive integer key beginning at 1).

Parameters: Return value:

table.removevalue( t, value, maxRemoveCount )

Remove the provided value from the provided table. If the index of the value is an integer, the value is nicely removed with table.remove(). /!\ Do not use this function on tables which have integer keys but that are not arrays (whose keys are not contiguous). /!\

Parameters: Return value:

table.reverse( t )

Reverse the order of the provided table's values.

Parameters: Return value:

table.setvalue( t, keys, value )

Safely set a value several levels down inside nested tables. Creates the missing levels if the series of keys is incomplete.
Ie for this series of nested table : table1.table2.fooBar
table.setvalue( table1, "table2.fooBar", true ) would set true as the value of the 'fooBar' key in the 'table1.table2' table. if table2 does not exists, it is created


Parameters:

table.shift( t, returnKey )

Remove and returns the first value found in the table. Works for arrays as well as associative tables.

Parameters: Return value:

table.sortby( t, property, orderBy )

Sort a list of table using one of the tables property as criteria.

Parameters: Return value:

tonumber2( data )

A more flexible version of tonumber(). Returns the first continuous series of numbers found in the text version of the provided data even if it is prefixed or suffied by other characters.

Parameters: Return value: