Posted 22 May 2015 - 07:19 PM
Hi,
I am trying to let 2 API's communicate (sort of). One variable gets made in one API and the other API uses it. Is it actually possible to get the variable? i know the code works (turned on redstone with it)
Here is the code from the first API called Com that creates the variable modem and sets it to true.
the second API called Updater checks if Modem is 1 and prints the modem is connected (full program does other things but thats isn't the point now.
and yeah a program to start the Updater API.
I am trying to let 2 API's communicate (sort of). One variable gets made in one API and the other API uses it. Is it actually possible to get the variable? i know the code works (turned on redstone with it)
Here is the code from the first API called Com that creates the variable modem and sets it to true.
function ModemConnected()
for T,side in ipairs(rs.getSides()) do
if peripheral.isPresent(side) and peripheral.getType(side) == "modem" then
rednet.open(side)
Modem = 1
print(Modem)
end
end
end
the second API called Updater checks if Modem is 1 and prints the modem is connected (full program does other things but thats isn't the point now.
os.loadAPI("Com")
Modem = 0
function FileReceiver()
Com.ModemConnected()
if Modem == 1 then
print("Modem connected")
end
print("test")
end
and yeah a program to start the Updater API.
os.loadAPI("Updater")
print("> Started")
Updater.FileReceiver()
print("> Done")