BreakObject: Difference between revisions
Jump to navigation
Jump to search
Zangomangu (talk | contribs) mNo edit summary |
No edit summary |
||
(4 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{ | {{Shared function}} | ||
This function breaks a specific object. {{New feature/item|3.0161|1.6.0|22489|This function is now also available on the server side.}} | |||
This function breaks a specific object. | {{Note|Only breakable objects can be broken.}} | ||
Note | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua">bool breakObject ( object theObject )</syntaxhighlight> | <syntaxhighlight lang="lua">bool breakObject ( object theObject )</syntaxhighlight> | ||
{{OOP||[[object]]:break}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theObject:''' | *'''theObject:''' an [[object]] element | ||
===Returns=== | ===Returns=== | ||
* ''true'' if the object was successfully broken. | |||
* ''false'' if the object is not breakable, or a wrong object was given. | |||
==Example== | |||
This example checks if the object created is breakable and if it is then breaks it. | |||
<syntaxhighlight lang="lua"> | |||
addCommandHandler("createObj", | |||
function(command, id) | |||
local x, y, z = getElementPosition(localPlayer) | |||
local object = createObject (id, x, y, z) | |||
if (id) then | |||
if isObjectBreakable(object) then | |||
breakObject(object) | |||
end | |||
end | |||
end | |||
) | |||
</syntaxhighlight> | |||
==See Also== | ==See Also== | ||
{{Client_object_functions}} | {{Client_object_functions}} |
Latest revision as of 10:53, 6 June 2024
This function breaks a specific object.
Syntax
bool breakObject ( object theObject )
OOP Syntax Help! I don't understand this!
- Method: object:break(...)
Required Arguments
- theObject: an object element
Returns
- true if the object was successfully broken.
- false if the object is not breakable, or a wrong object was given.
Example
This example checks if the object created is breakable and if it is then breaks it.
addCommandHandler("createObj", function(command, id) local x, y, z = getElementPosition(localPlayer) local object = createObject (id, x, y, z) if (id) then if isObjectBreakable(object) then breakObject(object) end end end )
See Also
- createObject
- getObjectScale
- moveObject
- setObjectScale
- stopObject
- getObjectMass
- getObjectProperty
- setObjectMass
- setObjectProperty