How to make a API

Started by Creepdasheep, Nov 09, 2022, 03:24 pm

Previous topic - Next topic


Nov 09, 2022, 03:24 pm Last Edit: Nov 09, 2022, 03:26 pm by Creepdasheep Reason: Fixing Sanax
step 1, make a script with the name of the api you want to call
step 2, go into the script and make some functions like..

Code Select
function wait(int)
 local waitint = tonumber(int)

Now in your main script insert your api
Code Select
with your function put the name of your api...
Code Select
Now you know how to make API's or you could have just gone to the wiki


Using `os.loadAPI` is one way of doing it. Another more modern way of doing it is `require`.

File a:
Code Select
local a = {}

local function a.sum(a, b)
  return a + b

return a

File b:
Code Select
local a = require("a")
a.sum(5+5) | Reusing code with require
Meow! 😺 | Krist: [email protected] or katpcscili or cats.kst