1847 posts
Location
/home/dannysmc95
Posted 19 March 2015 - 09:39 AM
So I want to make a program, I have an API for this program,
I want to be able to download the API and then run it and be able to call it?
I do not want to download and save it though as it is a big file?
So I can use say:
local req = http.get(<url_to_api>)
req = req.readAll()
api = loadstring(req)
Then be able to call like:
api.draw.box(args, etc)
Thanks!
Edited on 19 March 2015 - 08:40 AM
7083 posts
Location
Tasmania (AU)
Posted 19 March 2015 - 10:04 AM
Normally I'd tell you to read the code for os.loadAPI() from bios.lua, and write a modified version for yourself based on its content. However, at a glance,
this does exactly what you're asking already.
Though if you're thinking of using this for an OS of some sort, I suggest reconsidering. http calls on every boot? Bleh.
1847 posts
Location
/home/dannysmc95
Posted 19 March 2015 - 10:12 AM
No not an OS, just a program, and would you be able to explain to me?
7083 posts
Location
Tasmania (AU)
Posted 19 March 2015 - 11:34 PM
Er, explain what part to you, exactly?
1029 posts
Location
Missouri, United States, America, Earth, Solar System, Milky Way, Universe 42B, Life Street, Multiverse, 4th Dimension
Posted 20 March 2015 - 02:11 AM
No not an OS, just a program, and would you be able to explain to me?
In my topic, I have posted code. You paste it at the top of your program.
The function you want is:
pastePI
You give it
pastePI(pasteID,API)
For example if the JSON API was at paste ID XXXXX, you'd do:
pastePI("XXXXX","json")
and the table "json" would contain all functions of the JSON API.
1847 posts
Location
/home/dannysmc95
Posted 20 March 2015 - 09:11 AM
No not an OS, just a program, and would you be able to explain to me?
In my topic, I have posted code. You paste it at the top of your program.
The function you want is:
pastePI
You give it
pastePI(pasteID,API)
For example if the JSON API was at paste ID XXXXX, you'd do:
pastePI("XXXXX","json")
and the table "json" would contain all functions of the JSON API.
Ahh yes I have took the code apart and changed it so it works without having arguments, but you are a lifesaver for that, so thankyou!