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

PeripheralsPP Player Detector

Started by Browser8, 10 August 2016 - 03:36 PM
Browser8 #1
Posted 10 August 2016 - 05:36 PM
So i've been trying to make a program to say the names of the people detected by the detector but i can't make it say them.

s = peripheral.wrap("top")—–Speaker
de = peripheral.wrap("back")—–Player Detector
time = os.time()
formattedtime = textutils.formatTime(time, false)
pl = de.getNearbyPlayers(10)
print("The time is " .. formattedtime)
s.speak("Hello " .. pl .. "The time is " .. formattedtime)

I get the error .temp:7: attempt to concatenate table and string.

So you know this is going to end. Help!
Browser8 #2
Posted 10 August 2016 - 08:19 PM
http://pastebin.com/JygKf56b
fixed
Lupus590 #3
Posted 10 August 2016 - 10:58 PM
getNearbyPlayers() returns a table of players, assuming that the nearest player is the first one you want to use s.speak("Hello " .. pl[1] .. "The time is " .. formattedtime)