GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — AppliedOverInternet/send_request.lua at main · iTrooz/AppliedOverInternet Expand file tree/ Copy pathsend_request.luaMore file actions 73 lines (64 loc) · 1.89 KB / Copy pathsend_request.luaFile metadata and controls73 lines (64 loc) · 1.89 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 -- The script goes into the CC:Tweaked computer function log(msg) local time = os.epoch("local") / 1000 local time_str = os.date("%Y-%m-%d %T", time) print(time_str.." "..msg) end function round(n) return math.floor(n+0.5) end log("Starting program") bridge = peripheral.find("meBridge") while true do quantities = {} cat = bridge.listItems() if cat ~= nil then if type(cat) == "table" then for _, thing in pairs(cat) do strippedThing = { name = thing.name, amount = thing.amount, displayName = thing.displayName, type = "item" } table.insert(quantities, strippedThing) end else log("Error while processing AE:") log(cat) end end cat = bridge.listFluid() if cat ~= nil then if type(cat) == "table" then for _, thing in pairs(cat) do strippedThing = { name = thing.name, amount = round(thing.amount/1000), displayName = thing.displayName, type = "fluid" } table.insert(quantities, strippedThing) end else log("Error while processing AE:") log(cat) end end cat = bridge.listGas() if cat ~= nil then if type(cat) == "table" then for _, thing in pairs(cat) do strippedThing = { name = thing.name, amount = round(thing.amount/1000), displayName = thing.displayName, type = "gas" } table.insert(quantities, strippedThing) end else log("Error while processing AE:") log(cat) end end usageData = { items = { total = bridge.getTotalItemStorage(), used = bridge.getUsedItemStorage() }, fluid = { total = bridge.getTotalFluidStorage(), used = bridge.getUsedFluidStorage() } -- no gas yet ): } allData = { usage = usageData, items = quantities } http.post("http://localhost:5000/ae2", textutils.serialiseJSON(allData), {["Content-Type"]= "application/json"}) log("Request made. Now sleeping") sleep(5) end |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |