Posted 19 February 2015 - 09:08 AM
require()
This is a utility function that will make working with APIs so much easier. It doesn't replace os.loadAPI(), it enhances it. You can include many APIs at once, and they are stored in a local variable, reducing conflicts:
Another great feature is that it works with every api that works with os.loadAPI, whch means you don't need to change apis or ask the author to change them. The way they are stored in a local variable makes it even easier to use the touchpoint API:
Want it? To see more information and where to download it, see the https://github.com/comp500/CCSnippets for the github repository.
If you don't care about github and just want a download, minified versions are available in the releases: https://github.com/c...ippets/releases
My utilities are under the MIT license, so feel free to fork and send pull requests on the CCSnippets repository, but don't remove the license and give credit.
Please note that ComputerCraft 1.63 is required, see the github readme for more details.
To-Do list:
This is a utility function that will make working with APIs so much easier. It doesn't replace os.loadAPI(), it enhances it. You can include many APIs at once, and they are stored in a local variable, reducing conflicts:
module1, module2, module3... = require(location1, location2, location3...)
It is only around 600B when minified and can be inserted at the top of your programs. It searches for APIs, so you don't have to specify exactly where they are. If you require an absolute path (with a trailing slash), require will look just in that directory. If you require a relative path (no trailing slash), require will search in the current directory and all directories above it, for example:
-- /superstuff/awesome/lol
module1 = require("superapi")
module1.test()
-- /superapi
function test()
print("this is super")
end
require() would search:/superstuff/awesome/superapi
/superstuff/superapi
/superapi
Another great feature is that it works with every api that works with os.loadAPI, whch means you don't need to change apis or ask the author to change them. The way they are stored in a local variable makes it even easier to use the touchpoint API:
t = require("touchpoint").new()
t:add(...)
t:draw()
Want it? To see more information and where to download it, see the https://github.com/comp500/CCSnippets for the github repository.
If you don't care about github and just want a download, minified versions are available in the releases: https://github.com/c...ippets/releases
My utilities are under the MIT license, so feel free to fork and send pull requests on the CCSnippets repository, but don't remove the license and give credit.
Please note that ComputerCraft 1.63 is required, see the github readme for more details.
To-Do list:
- Add support for some sort of lib/ directory
Edited on 20 February 2015 - 06:49 AM