SHOW:
|
|
- or go back to the newest paste.
| 1 | function Chest(chest) | |
| 2 | chestID = chest | |
| 3 | end | |
| 4 | ||
| 5 | function Target(chest) | |
| 6 | if (not chestID) then | |
| 7 | error("A Cloud Chest has not been specified yet. First call Chest(id) where the id is your cx4 Chest key.")
| |
| 8 | end | |
| 9 | return chestID | |
| 10 | end | |
| 11 | ||
| 12 | function Set(location, data) | |
| 13 | if (not chestID) then | |
| 14 | error("A Cloud Chest has not been specified yet. First call Chest(id) where the id is your cx4 Chest key.")
| |
| 15 | end | |
| 16 | url = "http://boomtree.com/guid/" .. chestID .. ".cc?location=" .. location | |
| 17 | local ret = http.post(url, data) | |
| 18 | - | print(ret.readAll()) |
| 18 | + | |
| 19 | ||
| 20 | function Get(location) | |
| 21 | url = "http://boomtree.com/guid/" .. chestID .. ".cc?location="..location | |
| 22 | loop = true | |
| 23 | http.request(url) | |
| 24 | ||
| 25 | event, returnurl, response = os.pullEvent() | |
| 26 | while loop == true do | |
| 27 | if event == "http_success" then | |
| 28 | return response.readAll() | |
| 29 | else | |
| 30 | return | |
| 31 | - | print("The request failed.")
|
| 31 | + | |
| 32 | end | |
| 33 | end |