This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Josephnorthy's profile picture

napi A simple api

Started by Josephnorthy, 27 December 2016 - 01:48 PM
Josephnorthy #1
Posted 27 December 2016 - 02:48 PM
This api has two functions that are listed bellow and it is designed to send and receive files over rednet -


napi.sendFile(name,protocal) - this will send a complete file over rednet

napi.receivefile(name,protocal) - this is the second part of .sendfile and they will both need to be on the same protocol (the name can be different)


you will need the napi.receivefile started before the napi.sendFile

To get the api:
pastebin get 85nP6tvP napi


I hope you can make use of it and if you have any ideas for new functions comment below :-)
Edited on 29 December 2016 - 12:46 PM
Pyuu #2
Posted 27 December 2016 - 05:17 PM
A "quicker" way? The function name is just shorter.
KingofGamesYami #3
Posted 27 December 2016 - 05:42 PM
Additionally, it is actually slower because it adds an additional function call.
Josephnorthy #4
Posted 27 December 2016 - 07:37 PM
What I meant by quicker was just shorter so quicker to type
Bomb Bloke #5
Posted 28 December 2016 - 12:56 AM
Instead of doing stuff like this:

function broad(message,protocal)
rednet.broadcast(message,protocal)
end

… you have the option of just doing this:

broad = rednet.broadcast
Josephnorthy #6
Posted 28 December 2016 - 11:26 AM
I didn't know that was a possibility but that's a lot simpler that my method