os.unloadAPI("sensors")
os.loadAPI("/rom/apis/sensors")
function printDict(data)
for i,v in pairs(data) do
print(tostring(i).." - "..tostring(v))
end
end
data = sensors.getSensorReadingAsDict("left", "playerSensor", "vq", "Players.name")
print(data)
The problem i'm running into right now is it's returning a table, not a dictionary. It returns the value 'table: 1b0782c7'. Is there any way to convert this table to a word, for example the player's name.Also, going one step beyond this. How would I reference this in the program to open a door based on what player is around. A baseline for my code would be something like this. But I still have no clue how to reference the probe for player's name because it's returning a table.
local side = "left"
local opentime = 5
while true do
trusted = matt2887, Agnistu
if sensors.getSensorReadingAsDict("left", "playerSensor", "vq", "Players.name") == trusted then
rs.setOutput(side, true)
sleep(opentime)
rs.setOutput(side, false)
end
end
Edited by matt2887, 06 July 2014 - 04:48 AM.











