Join Date: Apr 2014
Posts: 74
|
Some new useful ingame functions
Found some new ingame functions. Feel free to document and use them
Misc - zo_binaryinsert (item, searchData, dataList, comparator)
- zo_binaryremove (searchData, dataList, comparator)
- zo_binarysearch (searchData, dataList, comparator)
- zo_callHandler (object, handler, ...)
- zo_clamp(value, minimum, maximum)
- zo_deltaNormalizedLerp (from, to, amount)
- zo_iconFormat(path, width, height)
- zo_iconTextFormat(path, width, height, text)
- zo_round(value)
- zo_roundToNearest(value, nearest)
- zo_roundToZero(value)
- zo_strtrim(str)
Tree node:
- ZO_TreeNode:New(myTree, controlData, myParent, childIndent)
return node
- ZO_TreeNode:SetExpandedCallback(callback)
- ZO_TreeNode:ToggleExpanded(expanded)
- ZO_TreeNode:IsExpanded()
- ZO_TreeNode:IsShowing()
- ZO_TreeNode:HasChildren()
- ZO_TreeNode:GetNestingLevel()
return nestingLevel
- ZO_TreeNode:GetControl()
return self.m_Control
- ZO_TreeNode:GetOwningTree()
return self.m_OwningTree
- ZO_TreeNode:GetNextSibling()
return self.m_Sibling
- ZO_TreeNode:GetParent()
return self.m_Parent
- ZO_TreeNode:GetChildIndent()
return self.m_ChildIndent
- ZO_TreeNode:SetOffsetY(offsetY)
Tree control:
- ZO_TreeControl:New(initialAnchor, indentXOffset, verticalSpacing)
return tree
- ZO_TreeControl:AddChild(atNode, insertedControl, childIndent)
return ?
- ZO_TreeControl:AddSibling(atNode, insertedControl, childIndent)
return ?
- ZO_TreeControl:AddSiblingAfterNode(atNode, insertedControl, childIndent)
return ?
- ZO_TreeControl:RemoveNode(node)
- ZO_TreeControl:Clear()
- ZO_TreeControl:Update(updateFromNode, indent, anchor, firstControl)
return anchor, indent
Table functions:
- NonContiguousCount(tableObject)
return count
- ZO_TableOrderingFunction(entry1, entry2, sortKey, sortKeys, sortOrder)
return: bool
Arguments:
entry1 (table) An entry in the table being sorted
entry2 (table) Another entry in the table being sorted
sortKey (non nil) A key in the entry arguments (tableX[sortKey]) to be used for sorting.
sortKeys (table) A table whose keys are all keys in entryX and whose values are all tables
(optionally containing tiebreaker and isNumeric)
sortOrder (number) Must be ZO_SORT_ORDER_UP or ZO_SORT_ORDER_DOWN
Return:
When sortOrder is ZO_SORT_ORDER_UP: entry1[sortKey] < entry2[sortKey]
When sortOrder is ZO_SORT_ORDER_DOWN: entry1[sortKey] > entry2[sortKey]
- ZO_ClearNumericallyIndexedTable(t)
- ZO_ClearTable(t)
- ZO_ShallowTableCopy(source, dest)
return table
- ZO_DeepTableCopy(source, dest)
return table
Hooking API
Install a handler that will be called before the original function and whose return value will decide if the original even needs to be called.
If the hook returns true it means that the hook handled the call entirely, and the original doesn't need calling.
ZO_PreHook can be called with or without an objectTable; if the argument is a string (the function name), it just uses _G
- ZO_PreHook(objectTable, existingFunctionName, hookFunction)
return function (?)
- ZO_PreHookHandler(control, handlerName, hookFunction)
return function (?)
Callback Manager- ZO_CallbackObject:New()
- ZO_CallbackObject:RegisterCallback(eventName, callback, arg)
Registers a callback to be executed when eventName is triggered.
You may optionally specify an argument to be passed to the callback.
- ZO_CallbackObject:UnregisterCallback(eventName, callback)
- ZO_CallbackObject:FireCallbacks(eventName, ...)
return result(?)
Executes all callbacks registered on this object with this event name
Accepts the event name, and a list of arguments to be passed to the callbacks
The return value is from the callbacks, the most recently registered non-nil non-false callback return value is returned
- ZO_CallbackObject:Clean(eventName)
Last edited by BadVolt : 04/21/14 at 01:14 PM.
|