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

Issue with Lua And OpenCCSensors

Started by XMystico, 04 September 2013 - 06:39 PM
XMystico #1
Posted 04 September 2013 - 08:39 PM
I seem to be having a problem with this,
the error i'm getting is "Test:11: attempt to ndex ? (a nill value)

It seems to be with the actual sensor itself,When it detects a new player inside the radius


os.loadAPI("ocs/apis/sensor")
s = sensor.Wrap("top")

local function Discovery()
while true do
t = s.getTargets()
for name, basicDetails in pairs(t) do
local chars  = s.getTargetDetails(name)
if chars.Name =="Player" then
print(name)
end
end
Discovery()
Lyqyd #2
Posted 04 September 2013 - 11:23 PM
Split into new topic.
LBPHacker #3
Posted 05 September 2013 - 12:19 AM
It isn't on line 11, line 11 is an end only. It might be line 2 where you have Wrap with a capital W. The OCS API contains methods with camelCased names; line 2 should be
local s = sensor.wrap("top")