Object

All pieces in the game are an Object. Once you have a reference to an Object you can call these functions like this: obj.getPosition(). You can get a reference multiple ways: using the self property on an Object scripts, using a GUID with getObjectFromGUID(), or as a return type from a function like takeObject().

The Global Script can be referenced by a special keyword Global. The Global reference is used only for functions getting or setting variables on the Global Script or for specifying the owner of a function in callbacks.

Member Variables

TypeVariable NameDescription
floatangular_dragThe Object’s angular drag.
boolauto_raiseShould this Object automatically raise above other Objects when held?
floatbouncinessThe Object’s bounciness.
ClockClockIf this Object is a Digital Clock, this member variable will be a reference to the Clock class attached to this Object, otherwise this value will be nil. Read only.
CounterCounterIf this Object is a Counter, this member variable will be a reference to the Counter class attached to this Object, otherwise this value will be nil. Read only.
floatdragThe Object’s drag.
floatdynamic_frictionThe Object’s dynamic friction.
boolgrid_projectionShould the grid project onto this object.
stringguidThe Object’s guid. This is the same as the getGUID function. Read only.
stringheld_by_colorThe color of the Player currently holding the Object. Will be nil if the Object is not being held by anyone. Read only.
boolinteractableCan players interact with this Object? If false, only Lua Scripts can interact with this Object.
floatmassThe Object’s mass.
stringnameThe Object’s formated name or nickname if applicable. Read only.
boolrestingReturns true if this Object is not moving. Setting this value will wake up or sleep the physics on this object.
RPGFigurineRPGFigurineIf this Object is an RPGFigurine, this member variable will be a reference to the RPGFigurine class attached to this Object, otherwise this value will be nil. Read only.
stringscript_codeReturns the Lua script on the Object.
stringscript_stateReturns the saved Lua script state on the Object. See onSave().
floatstatic_frictionThe Object’s static friction.
boolstickyShould Objects on top of this Object stick to this Object when this Object is picked up?
stringtagThe tag of the Object representing its type. Read only.
booltooltipShould Object show tooltips when hovering over it.
TextToolTextToolIf this Object is a TextTool, this member variable will be a reference to the TextTool class attached to this Object, otherwise this value will be nil. Read only.
booluse_gravityDoes gravity affect this Object?
booluse_gridShould this Object snap to grid points?
booluse_snap_pointsShould this Object snap to snap points?

Object Properties

Return ValueFunction NameDescription
stringgetDescription()Gets the description for this Object.
stringgetGUID()Returns the GUID that belongs to this Object.
stringgetLuaScript()Gets the Lua script for this Object.
stringgetName()Returns the nickname for this Object.
TablegetTable( string table_name )Gets a Lua Table for this Object.
variablegetVar( string variable_name )Gets a Lua variable for this Object. Will result in an error if you try to get a Table variable. Use getTable function for getting a Table from the Object.
boolsetDescription( string description )Sets the description for this Object.
boolsetLuaScript( string script )Sets the Lua script for this Object. Only useful in very rare cases right when this object is spawned. Once the Lua interpreter reads the Lua script, it will not care about this again. Setting this variable after its been read will do nothing.
boolsetName( string nickname )Sets the nickname for this Object.
boolsetTable( string table_name, Table table )Sets a Lua Table for this Object.
boolsetVar( string variable_name, variable value )Sets a Lua variable for this Object. Will result in an error if you try to set a Table variable. Use setTable function for setting a Table from the Object.

Object Transform Properties

Return ValueFunction NameDescription
booladdForce( Vector, int force_type ) Adds a force vector to the Object. The force type is optional and defaults to Impulse.

Force TypeValue
Constant Force (uses mass)1
Acceleration (ignores mass)2
Impulse (uses mass)3
Velocity Change (ignores mass)4
booladdTorque( Vector, int force_type ) Adds a torque vector to the Object. The force type is optional and defaults to Impulse.

Force TypeValue
Constant Force (uses mass)1
Acceleration (ignores mass)2
Impulse (uses mass)3
Velocity Change (ignores mass)4
boolflip()Flips this Object.
Vector
getAngularVelocity()Returns the current angular velocity vector of the Object.
Table
getBounds()Returns the world space axis aligned Bounds of the Object.

TypeNameDescription
VectorcenterThe center of the bounding box.
VectorsizeThe size of the bounding box.
VectoroffsetThe offset of the bounds center and the transform position.
Table
getBoundsNormalized()Returns the world space axis aligned Bounds of the Object at zero rotation.

TypeNameDescription
VectorcenterThe center of the bounding box.
VectorsizeThe size of the bounding box.
VectoroffsetThe offset of the bounds center and the transform position.
VectorgetPosition()Gets the position for this Object.
VectorgetRotation()Gets the rotation of this Object in degrees.
VectorgetScale()Gets the scale for this Object.
VectorgetTransformForward()Gets the forward direction of this Object.
VectorgetTransformRight()Gets the right direction of this Object.
VectorgetTransformUp()Gets the up direction of this Object.
VectorgetVelocity()Returns the current velocity vector of the Object.
boolisSmoothMoving()Is the object smoothly moving from our smooth functions.
VectorpositionToLocal( Vector )Converts the world position to a local position of this Object.
VectorpositionToWorld( Vector )Converts the local position of this Object to a world position.
boolrotate( Vector )Smoothly rotates this Object with the given offset in degrees, i.e. rotate Object 90 degrees in the x direction from its current orientation.
boolscale( Vector )Scales this Object by the given amount.
boolscale( float scale )Scales this Object in all axes by the given amount.
boolsetAngularVelocity( Vector )Sets the angular velocity of the object.
boolsetPosition( Vector )Sets the world space position for this Object.
boolsetPositionSmooth( Vector, bool Collide = false, bool Fast = false )Smoothly moves this Object from its current position to a given world space position. If there is a collision the object will be instantly teleported to the location.
boolsetRotation( Vector )Sets the rotation of this Object in degrees.
boolsetRotationSmooth( Vector, bool Collide = false, bool Fast = false )Smoothly rotates this Object to the given orientation in degrees.
boolsetScale( Vector )Sets the scale for this Object.
boolsetVelocity( Vector )Sets the velocity of the object.
booltranslate( Vector )Smoothly moves this Object from its current position to a given offset.

Material Properties

Return ValueFunction NameDescription
ColorgetColorTint()Returns the color tint for this Object.
boolsetColorTint( Color )Sets the color tint for this Object.

UI Functions

Return ValueFunction NameDescription
boolclearButtons()Clears all 3D UI buttons on this Object.
boolcreateButton( Table parameters ) Creates a 3D UI button on this Object.

Parameters Table:


local button_parameters = {}
button_parameters.click_function = string function_name
button_parameters.function_owner = Object function_owner
button_parameters.label = string button_label –Optional
button_parameters.position = Vector –Optional
button_parameters.rotation = Vector –Optional
button_parameters.scale = Vector –Optional
button_parameters.width = int width –Optional
button_parameters.height = int height –Optional
button_parameters.font_size = int font_size –Optional
button_parameters.color = Color –Optional
button_parameters.font_color = Color –Optional

A nil value for funtion_owner means the function lives on the Global script. The click_function runs with optional parameters: click_function(Object objectButtonClicked, string playerColorClicked).
booleditButton( Table parameters ) Edits a 3D UI button on this Object based on its index.

Parameter Table:


local button_parameters = {}
button_parameters.index = int index
button_parameters.click_function = string function_name –Optional
button_parameters.function_owner = Object function_owner –Optional
button_parameters.label = string button_label –Optional
button_parameters.position = Vector –Optional
button_parameters.rotation = Vector –Optional
button_parameters.scale = Vector –Optional
button_parameters.width = int width –Optional
button_parameters.height = int height –Optional
button_parameters.font_size = int font_size –Optional
button_parameters.color = Color –Optional
button_parameters.font_color = Color –Optional
TablegetButtons() Gets a list of all the 3D UI buttons on this Object.

Returned Table:


table.index = int index –The index of this button as a child of the Object. Used for editing or removing this specific button.
table.click_function = string click_function
table.function_owner = Object function_owner
table.label = string label_text
table.position = Table position –{x, y, z}
table.rotation = Table rotation –{x, y, z}
table.scale = Table scale–{x, y, z}
table.width = int button_width
table.height = int button_height
table.font_size = int font_size
table.color = Color
table.font_color = Color
boolremoveButton( int index )Removes a 3D UI button from this Object by its index.

Object Functions

Return ValueFunction NameDescription
variablecall( string function_name, Table function_parameters )Calls a Lua function owned by this Object and passes an optional Table as parameters to the function.
Objectclone( Table parameters ) Copies and pastes this Object. Returns a reference to the newly spawned Object.

Parameters Table:

local params = {}
params.position = Vector –Optional. Where to spawn the pasted Object. Defaults to {0, 3, 0}.
params.snap_to_grid = boolean snap_to_grid –Optional. Should the spawned Object snap to the grid if the grid is turned on? Defaults to false.
boolcut()Cuts this Object if it is a Deck or a Stack
booldealToAll( int num_cards )Deals a number of Cards from a this Deck to all seated players.
booldealToColor( int num_cards, string player_color )Deals a number of Cards from this Deck to a specific player.
ObjectdealToColorWithOffset( Vector, bool flip, string player_color )Deals a Card to a player with an offset from their hand. Set the offset to 0 to deal in their hand. Returns a reference to the dealt Card.
booldestruct()Destroys this Object. Mainly so you can call self.destruct().
TablegetCustomObject() Returns the custom parameters on a Custom Object.

Returned Table
KeyTypeDescription
imagestringImage URL for Custom Board, Custom Dice, Custom Figurine, Custom Tile, and Custom Token.
image_secondarystringSecondary / Back Image URL for Custom Figurine or Custom Tile.
typeintThe number of sides of the Custom Dice, the shape of the Custom Tile, the type of Custom Mesh, or the type of Custom AssetBundle.
thicknessfloatThickness of the Custom Tile or Custom Token.
stackableboolIs this Custom Tile or Custom Token stackable?
merge_distancefloatThe accuracy of the Custom Tile to it’s base image.
meshstringMesh URL for the Custom Mesh.
diffusestringDiffuse image URL for the Custom Mesh.
normalstringNormal image URL for the Custom Mesh.
colliderstringCollider URL for the Custom Mesh.
convexboolIs this Custom Mesh concave?
materialintThe material for the Custom Mesh or Custom AssetBundle.
specular_intensityfloatThe specular intensity for the Custom Mesh.
specular_colorTableThe specular color for the Custom Mesh.
specular_sharpnessfloatThe specular sharpness for the Custom Mesh.
fresnel_strengthfloatThe fresnel strength for the Custom Mesh.
cast_shadowsboolDoes this Custom Mesh cast shadows?
assetbundlestringAssetBundle URL for this Custom AssetBundle.
assetbundle_secondarystringSecondary AssetBundle URL for this Custom AssetBundle.
boolgetLock()Get the lock status of this object.
TablegetObjects() Returns all the Objects inside of this container.

ObjectReturned Data
Scripting ZoneReturns all Objects in the Zone.
Loot BagReturns a Table with the keys “name”, “guid”, and “index”. Objects in Loot Bags are not living in the game. They’re serialized into a text format. To interact with or change an Object in a Loot Bag, it must first be taken out (which spawns it in the game). Objects in Loot Bags can be taken out of the Bag by the takeObject function by referencing its “index” or “guid”. It’s recommended to remove Objects by their GUIDs rather than their indices since the indices can change after one object was removed.
DeckReturns a Table of Tables of all of the Cards in the Deck. These are not references to the cards since the Cards are not instantiated until they are removed from the Deck.

Card Table:


table.index = int index
table.nickname = string nickname
table.description = string description
table.guid = string guid
table.lua_script = string lua_script

intgetQuantity()Returns the number of Objects in a stack. Will return -1 if the object is not a stack.
intgetStateId()Returns id of the active state for this object. Will return -1 if the object has no states.
TablegetStates()Returns a Table with the keys “name”, “guid”, and “id”.
intgetValue() Returns the value for this Object.

ObjectValue
ClockReturns the current stopwatch or timer value.
CounterReturns the value.
DiceReturns the face-up value.
Poker ChipReturns the face value.
TabletReturns the URL.
boolhighlightOn( {float r, float g, float b }, float duration –Optional.
)
Highlight this object with color for an optional duration. Color values are between 0 and 1.
boolhighlightOff()Stop highlighting this object.
boolputObject( Object put_object )Add this object to the current object. Works for stacking chips, decks, and bags.
boolrandomize()Same as pressing the ‘R’ key on an Object. Shuffles deck/bag, rolls dice/coin, lifts any other object up in the air.
Objectreload()Reloads this object by destroying and spawning it place. Returns the newly spawned object. Very useful if using setCustomObject().
boolreset()Resets this Object. Resetting a Deck brings all the Cards back into it. Resetting a Bag clears its contents (works for both Loot and Infinite Bags).
boolroll()Rolls this Object. Works on Dice and Coins.
boolsetCustomObject( Table parameters )Used to create a Custom Object. All custom types except for Custom Decks are supported. See here for information about the parameters for each type of Custom Object.
boolsetLock( bool lock )Set the lock status of an object.
ObjectsetState( int state )Sets the current State for this Object if it has multiple States attached to it and returns a reference to the new State. The old reference will be destroyed, so update your reference to this Object with the return value of the new State. Returns nil if this Object does not have multiple states attached to it.
boolsetValue( variable value ) Sets the value for this Object.

ObjectValue
ClockSets the timer value.
CounterSets the value.
DiceSets the face-up value.
TabletSets the URL.
boolshuffle()Shuffles this Object.
Objects this works on:
Deck
Loot Bag
ObjectshuffleStates()Shuffles the States on this Object if it has multiple States attached to it and returns a reference to the new State. The old reference will be destroyed, so update your reference to this Object with the return value of the new State. Returns nil if this Object does not have multiple states attached to it.
ObjecttakeObject( Table parameters )Takes an Object from this container (Loot Bag, Deck, and Infinite Bag), moves, and rotates it to the specified position and rotation. Returns a reference to the taken Object. Since executing the Lua scripts on the taken object and other initialization takes a few frames, any operations that need to be performed on this object immediately after it is taken from the container should be done in the callback function. The callback prevents needing to use a coroutine and yielding/waiting multiple frames. All of the parameters are optional and defers to default values if any of the lines are not included. If you want all of the default values, just pass in an empty table.

Parameters Table:


local params = {}
params.position = Vector –Optional. Defaults to the container’s position + 2 in the x direction.
params.rotation = Vector –Optional. Defaults to the container’s rotation.
params.callback = string callback_function_name –Optional.
params.callback_owner = Object callback_owner –Optional. Defaults to the container that the Object was taken from.
params.params = Table callback_parameters –Optional.
params.flip = boolean flip_object –Optional. Only used when taking Cards from a Deck.
params.guid = string guid –Optional. Only used when taking an Object from a Loot Bag by GUID.
params.index = int index –Optional. Used when taking an Object from a Loot Bag or a Card from a Deck by index.
params.top = bool take_from_top –Optional. Specifies whether to take a Card from the top or bottom of the Deck. Defaults to true, taking from the top of the Deck.

It’s recommended to remove Objects from Loot Bags by their GUIDs rather than their indices since the indices can change after one object was removed.