This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
minionlib [2018/04/18 08:44] – fxfire | minionlib [2021/01/17 20:19] – Response headers string to table example kali | ||
---|---|---|---|
Line 59: | Line 59: | ||
ml_gui.ui_mgr: | ml_gui.ui_mgr: | ||
</ | </ | ||
+ | |||
===Utility Functions=== | ===Utility Functions=== | ||
+ | |||
+ | ==General== | ||
+ | ***'' | ||
+ | *Prints out the passed variable or the result of a function into the console. | ||
+ | ***'' | ||
+ | *Prints out the current call stack into the console. | ||
+ | ***'' | ||
+ | *Closes the current game instance | ||
+ | ***'' | ||
+ | *Prints our the passed variable or the result of a function into the console when gEnableLog == " | ||
+ | ***'' | ||
+ | *Prints our the passed variable or the result of a function into the console. | ||
+ | ***'' | ||
+ | *Adds the string to the statusbar-line which gets shown on each pulse. | ||
+ | ***'' | ||
+ | *Returns tickcount from ml_global_information.Now | ||
+ | ***'' | ||
+ | *Registers a local handler to an event | ||
+ | ***'' | ||
+ | *Returns //bool// , reloads all lua modules | ||
+ | ***'' | ||
+ | *Returns //integer// ml_global_information.Now - previousTime | ||
+ | ***'' | ||
+ | *Returns //bool// , tries to unload the bot | ||
+ | ***'' | ||
+ | *Queues and Fires the Event with 1-n arguments. Eventname and arguments need to be strings. | ||
+ | *Use RegisterEventHandler(" | ||
+ | |||
+ | |||
==File I/O== | ==File I/O== | ||
For every I/O function, you need to use double dashes! Example: FolderExists(" | For every I/O function, you need to use double dashes! Example: FolderExists(" | ||
Line 78: | Line 108: | ||
***'' | ***'' | ||
*Returns // | *Returns // | ||
+ | ***'' | ||
+ | *Returns // | ||
+ | ***'' | ||
+ | *Returns //number// | ||
***'' | ***'' | ||
*Returns //bool// | *Returns //bool// | ||
Line 178: | Line 212: | ||
- | ==General== | ||
- | ***'' | ||
- | *Prints our the passed variable or the result of a function into the console. | ||
- | ***'' | ||
- | *Closes the current game instance | ||
- | ***'' | ||
- | *Prints our the passed variable or the result of a function into the console when gEnableLog == " | ||
- | ***'' | ||
- | *Prints our the passed variable or the result of a function into the console. | ||
- | ***'' | ||
- | *Adds the string to the statusbar-line which gets shown on each pulse. | ||
- | ***'' | ||
- | *Returns tickcount from ml_global_information.Now | ||
- | ***'' | ||
- | *Registers a local handler to an event | ||
- | ***'' | ||
- | *Returns //bool// , reloads all lua modules | ||
- | ***'' | ||
- | *Returns //integer// ml_global_information.Now - previousTime | ||
- | ***'' | ||
- | *Returns //bool// , tries to unload the bot | ||
- | ***'' | ||
- | *Queues and Fires the Event with 1-n arguments. Eventname and arguments need to be strings. | ||
- | *Use RegisterEventHandler(" | ||
==Navigation== | ==Navigation== | ||
Line 209: | Line 219: | ||
+ | |||
+ | ==Structure== | ||
+ | |||
+ | The minion is layered into 3 distinct parts, components, members, and submembers. | ||
+ | |||
+ | All components must have a header and (optionally) members, which are displayed when the header is clicked (and the menu is open).\\ | ||
+ | All component headers require the following properties: **//bool// '' | ||
+ | All component headers optionally contain the following properties: **// | ||
+ | |||
+ | Members are displayed below their component containers, and they represent the rows that appear directly below the header.\\ | ||
+ | Members may optionally contain submembers.\\ | ||
+ | All members require the following properties: **// | ||
+ | All members optionally contain the following properties: **// | ||
+ | |||
+ | Submembers are displayed to the right and grow vertically downward. | ||
+ | Submembers will be sorted in alphabetical order by name if the **'' | ||
+ | All submembers require the following properties: **// | ||
+ | All submembers optionally contain the following properties: **// | ||
+ | |||
+ | ==API== | ||
+ | |||
+ | ***'' | ||
+ | ***'' | ||
+ | ***'' | ||
+ | |||
+ | |||
+ | ===HTTPRequest=== | ||
+ | Use this function to do any kind of asynchronous http calls. Example: | ||
+ | |||
+ | <code lua> | ||
+ | function SendHttpRequest() | ||
+ | local function success(str, | ||
+ | d(" | ||
+ | d(" | ||
+ | d(" | ||
+ | |||
+ | local data = json.decode(str) | ||
+ | if data then | ||
+ | | ||
+ | | ||
+ | end | ||
+ | | ||
+ | local function HeadersTable(header) | ||
+ | if type(header) == " | ||
+ | header = string.match(header," | ||
+ | local tbl = {} | ||
+ | for w in header: | ||
+ | local k,v = string.match(w," | ||
+ | | ||
+ | end | ||
+ | table.print(tbl) | ||
+ | return tbl | ||
+ | end | ||
+ | end | ||
+ | | ||
+ | header = HeadersTable(header) -- if you want to convert the header string to a table | ||
+ | end | ||
+ | |||
+ | local function failed(error, | ||
+ | d(" | ||
+ | d(" | ||
+ | d(" | ||
+ | end | ||
+ | |||
+ | local params = { | ||
+ | host = " | ||
+ | path = "/ | ||
+ | port = 443, | ||
+ | method = " | ||
+ | https = true, | ||
+ | onsuccess = success, | ||
+ | onfailure = failed, | ||
+ | getheaders = true, --true will return the headers, if you dont need it you can leave this at nil | ||
+ | body = "", | ||
+ | headers = {}, --optional, if not required for your call can be nil or "" | ||
+ | } | ||
+ | |||
+ | | ||
+ | end | ||
+ | </ |