SHOW:
|
|
- or go back to the newest paste.
| 1 | - | simple = {}
|
| 1 | + | |
| 2 | root = _G | |
| 3 | ||
| 4 | - | simple.protected = _G |
| 4 | + | print = root.print |
| 5 | run = root.dofile | |
| 6 | - | simple.print = simple.protected.print |
| 6 | + | error = root.error |
| 7 | - | simple.run = simple.protected.dofile |
| 7 | + | |
| 8 | iterator = {}
| |
| 9 | - | simple.throwException = simple.protected.error |
| 9 | + | iterator.keyvalue = root.pairs |
| 10 | iterator.numerical = root.ipairs | |
| 11 | - | simple.iterator = {}
|
| 11 | + | |
| 12 | - | simple.iterator.keyvalue = simple.protected.pairs |
| 12 | + | local string = root.string |
| 13 | - | simple.iterator.numerical = simple.protected.ipairs |
| 13 | + | local table = root.table |
| 14 | local coroutine = root.coroutine | |
| 15 | - | simple.string = simple.protected.string |
| 15 | + | local math = root.math |
| 16 | local parallel = root.parallel | |
| 17 | - | simple.net = {}
|
| 17 | + | |
| 18 | - | simple.net.open = simple.protected.rednet.open |
| 18 | + | net = {}
|
| 19 | - | simple.net.close = simple.protected.rednet.open |
| 19 | + | net.open = root.rednet.open |
| 20 | - | simple.net.status = simple.protected.rednet,isOpen |
| 20 | + | net.close = root.rednet.open |
| 21 | - | simple.net.send = simple.protected.rednet.send |
| 21 | + | net.status = root.rednet,isOpen |
| 22 | - | simple.net.sendAll = simple.protected.rednet.broadcast |
| 22 | + | net.send = root.rednet.send |
| 23 | - | simple.net.standby = simple.protected.rednet.receive |
| 23 | + | net.sendAll = root.rednet.broadcast |
| 24 | - | simple.dns = {}
|
| 24 | + | net.standby = root.rednet.receive |
| 25 | - | simple.dns.register = simple.protected.rednet.host |
| 25 | + | |
| 26 | - | simple.dns.unregister = simple.protected.rednet.unhost |
| 26 | + | dns = {}
|
| 27 | - | simple.dns.lookup = simple.protected.rednet.lookup |
| 27 | + | dns.register = root.rednet.host |
| 28 | dns.unregister = root.rednet.unhost | |
| 29 | - | simple.convert = {}
|
| 29 | + | dns.lookup = root.rednet.lookup |
| 30 | - | simple.convert.toNumber = simple.protected.tonumber |
| 30 | + | |
| 31 | - | simple.convert.toString = simple.protected.tostring |
| 31 | + | convert = {}
|
| 32 | convert.toNumber = root.tonumber | |
| 33 | - | simple.event = {}
|
| 33 | + | convert.toString = root.tostring |
| 34 | - | simple.event.network = "rednet_message" |
| 34 | + | convert.getType = root.type |
| 35 | - | simple.event.mouse = "mouse_click" |
| 35 | + | |
| 36 | - | simple.event.keyboard = "key" |
| 36 | + | event = {}
|
| 37 | - | simple.event.modem = "modem_message" |
| 37 | + | event.network = "rednet_message" |
| 38 | event.mouse = "mouse_click" | |
| 39 | - | simple.system = {}
|
| 39 | + | event.keyboard = "key" |
| 40 | - | simple.system.handleEvent = simple.protected.os.pullEvent |
| 40 | + | event.modem = "modem_message" |
| 41 | - | simple.system.shutdown = simple.protected.os.shutdown |
| 41 | + | |
| 42 | - | simple.system.reboot = simple.protected.os.reboot |
| 42 | + | system = {}
|
| 43 | - | --simple.system.setPath = simple.protected.shell.setPath |
| 43 | + | system.handleEvent = root.os.pullEvent |
| 44 | system.shutdown = root.os.shutdown | |
| 45 | - | simple.debug = {}
|
| 45 | + | system.reboot = root.os.reboot |
| 46 | - | simple.debug.rawset = simple.protected.rawset |
| 46 | + | |
| 47 | - | simple.debug.rawget = simple.protected.rawget |
| 47 | + | debug = {}
|
| 48 | - | simple.debug.protect = simple.protected.xpcall |
| 48 | + | debug.rawset = root.rawset |
| 49 | - | simple.debug.execute = simple.protected.assert |
| 49 | + | debug.rawget = root.rawget |
| 50 | - | simple.debug.callEvent = simple.protected.os.queueEvent |
| 50 | + | debug.protect = root.xpcall |
| 51 | debug.execute = root.assert | |
| 52 | - | simple.import = simple.protected.os.loadAPI |
| 52 | + | debug.callEvent = root.os.queueEvent |
| 53 | ||
| 54 | - | --simple.path = simple.protected.shell.path |
| 54 | + | import = root.os.loadAPI |
| 55 | ||
| 56 | - | simple.fs = {}
|
| 56 | + | download = root.http.get |
| 57 | - | simple.fs.copy = simple.protected.fs.copy |
| 57 | + | upload = root.http.post |
| 58 | - | simple.fs.move = simple.protected.fs.move |
| 58 | + | |
| 59 | - | simple.fs.find = simple.protected.fs.find |
| 59 | + | getRedstone = root.rs.getInput |
| 60 | - | simple.fs.list = simple.protected.fs.list |
| 60 | + | setRedstone = root.rs.setOutput |
| 61 | - | simple.fs.delete = simple.protected.fs.delete |
| 61 | + | |
| 62 | - | simple.fs.exists = simple.protected.fs.exists |
| 62 | + | openFileIO = root.fs.open |
| 63 | - | simple.fs.isDirectory = simple.protected.fs.isDir |
| 63 | + | |
| 64 | class = function(properties) | |
| 65 | - | simple.download = simple.protected.http.get |
| 65 | + | if convert.getType(properties) ~= table then |
| 66 | - | simple.upload = simple.protected.http.post |
| 66 | + | error("class properties must be provided in a table")
|
| 67 | else | |
| 68 | - | simple.getRedstone = simple.protected.rs.getInput |
| 68 | + | root.setmetatable({}, properties)
|
| 69 | - | simple.setRedstone = simple.protected.rs.setOutput |
| 69 | + | properties.__index = properties |
| 70 | return properties | |
| 71 | - | simple.openForIO = simple.protected.fs.open |
| 71 | + | end |
| 72 | end | |
| 73 | ||
| 74 | simple = {root, print, run, error, iterator, string, table, coroutine, math, parallel, net, dns, convert, event, system, debug, import, root.fs, download, upload, getRedstone, setRedstone, openFileIO, class}
| |
| 75 | ||
| 76 | return simple |