GetObjectScale: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Fixed example) |
||
(4 intermediate revisions by 4 users not shown) | |||
Line 5: | Line 5: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
float getObjectScale ( object theObject ) | float, float, float getObjectScale ( object theObject ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[object]]:getScale|scale|setObjectScale}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theObject''': | *'''theObject''': the [[object]] you wish to return the scale of. | ||
===Returns=== | ===Returns=== | ||
* Three [[float]] values indicating the scale of the object on the x, y, and z axis, if successful. | |||
* ''false'' otherwise. | |||
==Example== | ==Example== | ||
<section name="Client" class="client" show="true"> | <section name="Client" class="client" show="true"> | ||
This example adds a command ''get_scale'' which create object and prints out a scale object. | This example adds a command ''get_scale'' which create object and prints out a scale of the object. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
addCommandHandler( 'get_scale', | addCommandHandler( 'get_scale', | ||
function( ) | function( ) | ||
local uObject = createObject( 1337, getElementPosition( localPlayer ) ) | local uObject = createObject( 1337, getElementPosition( localPlayer ) ) | ||
local x, y, z = getObjectScale( uObject ) | |||
outputChatBox( "Object scale on X axis: "..x.." on Y axis: "..y.." on Z axis: "..z ) | |||
end | end | ||
) | ) | ||
Line 29: | Line 31: | ||
==See Also== | ==See Also== | ||
{{Object_functions}} | {{Object_functions}} | ||
Revision as of 15:06, 28 February 2018
This function returns the visible size of an object.
Syntax
float, float, float getObjectScale ( object theObject )
OOP Syntax Help! I don't understand this!
- Method: object:getScale(...)
- Variable: .scale
- Counterpart: setObjectScale
Required Arguments
- theObject: the object you wish to return the scale of.
Returns
- Three float values indicating the scale of the object on the x, y, and z axis, if successful.
- false otherwise.
Example
Click to collapse [-]
ClientThis example adds a command get_scale which create object and prints out a scale of the object.
addCommandHandler( 'get_scale', function( ) local uObject = createObject( 1337, getElementPosition( localPlayer ) ) local x, y, z = getObjectScale( uObject ) outputChatBox( "Object scale on X axis: "..x.." on Y axis: "..y.." on Z axis: "..z ) end )
See Also