This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
minionlib_lua_api [2015/04/24 10:40] – fxfire | minionlib_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 | ||
- | </ | ||
- | |||
- | |||
- | ===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(// | ||
- | *Registers a local handler to an event | ||
- | ***Reload()** | ||
- | *Returns //bool// , reloads all lua modules | ||
- | ***TimeSince(// | ||
- | *Returns //integer// ml_global_information.Now - previousTime | ||
- | ***Unload(// | ||
- | *Returns //bool// , tries to unload the bot | ||
- | |||
- | |||
- | |||
- | |||
- | ==File I/O== | ||
- | ***FileExists(// | ||
- | *Returns // | ||
- | ***dirlist(// | ||
- | *Returns //table// , all filenames in that folder | ||
- | ***fileread(// | ||
- | *Returns // | ||
- | ***filewrite(// | ||
- | *Returns // | ||
- | ***LinesFrom(// | ||
- | *Returns //table// , this one cleanes the lines unlike fileread | ||
- | ***LoadFile(// | ||
- | *Loads a lua script from a file | ||
- | |||
- | |||
- | |||
- | ==Math== | ||
- | ***ApproxEqual(// | ||
- | *Returns // | ||
- | ***round(// | ||
- | *Returns // | ||
- | ***randomize(// | ||
- | *Returns //integer// , takes in a percentage from 0-100 and gives back a random number " | ||
- | |||
- | ==Navigation== | ||
- | ***PathDistance(// | ||
- | *Returns // | ||
- | |||
- | |||
- | ==Strings== | ||
- | ***MultiComp(// | ||
- | *Returns //bool//, criteria should be (, | ||
- | ***IsNullString(// | ||
- | *Returns // | ||
- | ***StringContains(// | ||
- | *Returns //bool// | ||
- | ***StringSplit(// | ||
- | *Returns // | ||
- | ***StringToTable(// | ||
- | *Returns //table// | ||
- | ***TrimString(// | ||
- | *Returns //string// | ||
- | ***ValidString(// | ||
- | *Returns //bool// | ||
- | ***ValidString(// | ||
- | *Returns //bool// | ||
- | |||
- | |||
- | |||
- | ==Tables== | ||
- | ***deepcompare(// | ||
- | *Returns //bool//, compares two tables if they are equal | ||
- | ***pairsByKeys (// | ||
- | *Returns // | ||
- | ***spairs(// | ||
- | *Returns // | ||
- | ***TableContains(// | ||
- | *Returns //bool// | ||
- | ***table_invert(// | ||
- | *Returns //table//, flips a table so keys become values | ||
- | ***table_merge(// | ||
- | *Returns //table// | ||
- | ***TableInsertSort(// | ||
- | *Returns // | ||
- | ***TableRemoveSort(// | ||
- | *Returns // | ||
- | ***ValidTable(// | ||
- | *Returns //bool// | ||
- | |||
- | |||