Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local side = require("sides")
- local rs = component.block_refinedstorage_interface
- local internet = require("internet")
- local itemList = rs.getItems()
- local patternList = rs.getPatterns()
- local fluidList = rs.getFluids()
- local currentTasks = rs.getTasks()
- function split(string, delim)
- local result = {};
- for match in (string..delim):gmatch("(.-)"..delim) do
- table.insert(result,match)
- end
- return result;
- end
- --Post Data to Web API
- function postWeb(data,url)
- local handle = internet.request(url, "
- {
- "name" : data.name,
- "size" : data.size,
- "mod" : data.mod,
- "description" : data.summary
- }", {}, "POST")
- local result = ""
- for chunk in handle do result = result..chunk end
- -- Print the body of the HTTP response
- -- print(result)
- -- Grab the metatable for the handle. This contains the
- -- internal HTTPRequest object.end
- local mt = getmetatable(handle)
- end
- --Get Data From Web API
- function getWeb(data,url)
- local handle = internet.request(url, "", {}, "GET")
- local result = ""
- for chunk in handle do result = result..chunk end
- local mt = getmetatable(handle)
- end
- function postItems(rsItems)
- local table = {}
- for k,v in ipairs(rsItems) do
- table[1] = v.name
- table[2] = v.size
- table[3] = "Hello Word"
- table[4] = split(v.name)
- end
- return table
- end
- --Call Functions Here
- --(Main Function Area)
- --Post new data to web API
- local result = postItems(itemList)
- sendToWeb(result,"https://seanwdoran.tech/api/create")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement