User Tools

Site Tools



minionlib_lua_api

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
minionlib_lua_api [2015/04/24 10:40] fxfireminionlib_lua_api [2015/06/18 13:25] (current) – removed fxfire
Line 1: Line 1:
-====MinionLib Lua==== 
-This library is holding the core functionality on which all our bots are running. You can freely use the available functions for your Addon, in order to do that, you just need to open your **module.def** and set the dependency of your Addon to the lib: 
-<code lua> 
-[Module] 
-Name=YourAddon 
-Dependencies=minionlib 
-Version=1 
-Files=myluacode.lua 
-Enabled=1 
-</code> 
- 
- 
-===Utility Functions=== 
-==General== 
-  ***d(...)** 
-    *Prints our the passed variable or the result of a function into the console. 
-  ***Exit()** 
-    *Closes the current game instance 
-  ***getStartupPath()** 
-    *Returns //string// root folderpath of the bot 
-  ***Now()** 
-    *Returns tickcount from ml_global_information.Now 
-  ***RegisterEventHandler(//string//eventtoregisterfor,//function//handler)** 
-    *Registers a local handler to an event 
-  ***Reload()** 
-    *Returns //bool// , reloads all lua modules 
-  ***TimeSince(//integer// previousTime)** 
-    *Returns //integer// ml_global_information.Now - previousTime 
-  ***Unload(//integer// previousTime)** 
-    *Returns //bool// , tries to unload the bot 
- 
- 
- 
- 
-==File I/O== 
-  ***FileExists(//string// pathtofile)** 
-    *Returns //bool//  
-  ***dirlist(//string// folderpath)** 
-    *Returns //table// , all filenames in that folder 
-  ***fileread(//string// pathtofile)** 
-    *Returns //table//  
-  ***filewrite(//string// pathtofile, //string//strtowrite)** 
-    *Returns //bool//  
-  ***LinesFrom(//string// pathtofile)** 
-    *Returns //table// , this one cleanes the lines unlike fileread 
-  ***LoadFile(//string//pathtofile)** 
-    *Loads a lua script from a file 
- 
- 
- 
-==Math== 
-  ***ApproxEqual(//number//num1,//number// num2)** 
-    *Returns //bool//  
-  ***round(//number// num, //integer//decimals)** 
-    *Returns //number//  
-  ***randomize(//integer// int)** 
-    *Returns //integer// , takes in a percentage from 0-100 and gives back a random number "near" that value 
- 
-==Navigation== 
-  ***PathDistance(//table//posTable)** 
-    *Returns //number//distance, usage: PathDistance(NavigationManager:GetPath(myPos.x,myPos.y,myPos.z,p.x,p.y,p.z)) 
- 
- 
-==Strings== 
-  ***MultiComp(//number or string//search, criteria)** 
-    *Returns //bool//, criteria should be (,)-separated for OR's, (+)-separated for AND's 
-  ***IsNullString(//string// arg)** 
-    *Returns //bool//  
-  ***StringContains(//string//str, item)** 
-    *Returns //bool// 
-  ***StringSplit(//string//s,//string//delimiter)** 
-    *Returns //function//iterator, usage:for itemid in StringSplit(potions,";") do 
-  ***StringToTable(//string//str, //string//delimiter)** 
-    *Returns //table// 
-  ***TrimString(//string//str, //integer// numtoremovefromtheend)** 
-    *Returns //string// 
-  ***ValidString(//string// arg)** 
-    *Returns //bool// 
-  ***ValidString(//string// arg)** 
-    *Returns //bool// 
- 
- 
- 
-==Tables== 
-  ***deepcompare(//table//table1,//table//table2,//bool//ignore_metatable)** 
-    *Returns //bool//, compares two tables if they are equal 
-  ***pairsByKeys (//table//table)** 
-    *Returns //function//iterator,  iterates over a table by keys, usage: for k,v in pairsByKeys(table) do 
-  ***spairs(//table//table, ''//function//sortfunc'')** 
-    *Returns //function//iterator,  iterates over and optionally sorts a table by keys, for k,v in spairs(TP.table,sort_func) do 
-  ***TableContains(//table//table, element)** 
-    *Returns //bool// 
-  ***table_invert(//table//table)** 
-    *Returns //table//, flips a table so keys become values  
-  ***table_merge(//table//table1,//table//table2)** 
-    *Returns //table// 
-  ***TableInsertSort(//table//tblSort, //integer//iInsertPoint, //tableitem//vInsertValue)** 
-    *Returns //table//orderedTable 
-  ***TableRemoveSort(//table//tblSort, //integer//iRemovePoint)** 
-    *Returns //table//orderedTable 
-  ***ValidTable(//table// arg)** 
-    *Returns //bool// 
- 
- 
  
minionlib_lua_api.1429872000.txt.gz · Last modified: 2015/04/24 10:40 by fxfire