Difference between revisions of "Engine Function Documentation Template"

From Legends of Aria Admin and Modding Wiki
Jump to: navigation, search
(CanDrop(...))
Line 1: Line 1:
You can use the code of this page as a template when creating a function documentation in the "Shards Online Lua Interface" category.
+
{''You can use the code of this page as a template when creating a function documentation in the "Shards Online Lua Interface" category. Everything italic in curly brackets is just a comment or explanation and not part of the template.''}
 
 
==CanDrop(...)==
 
  
 +
== SetWorldPosition(...)===
 +
'''Function Type:''' Engine API {''Is it an API or a default ruleset function?''}
 +
===Description ===
 +
Set the position of this object in the world
 
=== Prototype ===
 
=== Prototype ===
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
function CanDrop(mObj, mLoc)
+
mBool = mObj:SetWorldPosition(mLoc )
 
</syntaxhighlight>
 
</syntaxhighlight>
'''Parameters:'''
+
Parameters:
* (gameObj) mObj: The target gameobject
+
* (GameObj) mObj: The gameobject you want to place somewhere in the world
* (Loc) mLoc: The Location used in the function
+
* (Loc) mLoc: The location where to put the object
'''Return Values'''
+
Return Values
* (boolean): Returns true when mObj can be dropped at mLoc, false otherwise
+
* (boolean) mBool: True on success. False otherwise.
'''Description:''' CanDrop() is an example function used for this template. When implemented, it might tell you if you can drop something (mObj) somewhere (mLoc) and returns if it is possible (boolean).
+
=== Notes and Caveats ===
=== Caveats ===
+
This works for both mobile and non-mobile objects. This will remove objects from containers and equipment slots
Non existing sample function for documentation prototyping only.
+
<br>Don't place GameObjects outside the map coordinates. Just don't do it. Its evil
 
=== Examples ===
 
=== Examples ===
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
print("My example code goes here"..tostring(CanDrop(mObj,mLoc)))
+
-- puts "this" to the map origin
 +
mLoc = Loc(0,0,0)
 +
mResult = this:SetWorldPosition(mLoc)
 +
print("Success: "..tostring(mResult) )
 
</syntaxhighlight>
 
</syntaxhighlight>
And here goes some explanation
 
 
 
 
 
 
 
  
[[Category:Shards Online Lua Interface]]
+
[[Category:Shards Online Lua Interface]][[Category:Function Reference]]

Revision as of 15:37, 1 November 2016

{You can use the code of this page as a template when creating a function documentation in the "Shards Online Lua Interface" category. Everything italic in curly brackets is just a comment or explanation and not part of the template.}

SetWorldPosition(...)=

Function Type: Engine API {Is it an API or a default ruleset function?}

Description

Set the position of this object in the world

Prototype

mBool = mObj:SetWorldPosition(mLoc )

Parameters:

  • (GameObj) mObj: The gameobject you want to place somewhere in the world
  • (Loc) mLoc: The location where to put the object

Return Values

  • (boolean) mBool: True on success. False otherwise.

Notes and Caveats

This works for both mobile and non-mobile objects. This will remove objects from containers and equipment slots
Don't place GameObjects outside the map coordinates. Just don't do it. Its evil

Examples

-- puts "this" to the map origin
mLoc = Loc(0,0,0)
mResult = this:SetWorldPosition(mLoc)
print("Success: "..tostring(mResult) )