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

attempt to get length of nil

Started by Finn, 26 July 2015 - 03:18 PM
Finn #1
Posted 26 July 2015 - 05:18 PM
I code program that teleport player to random points and i have a problem
When i click right mouse button i have message with error

context:28:attempt to get length of nil
But, i cant find the error in code
Can you help me?
The code is here: http://pastebin.com/dHREH46h
Edited on 26 July 2015 - 03:18 PM
SquidDev #2
Posted 26 July 2015 - 05:33 PM
The issue is on line 28 of the context API. Can you provide us with a link to the source of that? There will be an expression like:

... = #foo
--      ^ This value is nil.
Finn #3
Posted 26 July 2015 - 05:35 PM
The issue is on line 28 of the context API. Can you provide us with a link to the source of that? There will be an expression like:

... = #foo
--	  ^ This value is nil.
Are you need the link of context API?
Edited on 26 July 2015 - 03:35 PM
SquidDev #4
Posted 26 July 2015 - 05:39 PM
The issue is on line 28 of the context API. Can you provide us with a link to the source of that? There will be an expression like:

... = #foo
--	  ^ This value is nil.
Are you need the link of context API?
Yep. It is in that file that the issue is occurring.
Finn #5
Posted 26 July 2015 - 05:49 PM
The issue is on line 28 of the context API. Can you provide us with a link to the source of that? There will be an expression like:

... = #foo
--	  ^ This value is nil.
Are you need the link of context API?
Yep. It is in that file that the issue is occurring.
Context API is here: http://pastebin.com/TRUJgUme
flaghacker #6
Posted 26 July 2015 - 06:12 PM
At line 20 of your program, some of the elements in the table aren't tables, they're just strings ("Auras", "-"). I think that's causing th problem.

I also noticed your tp function is broken, is that why you're not using it? :P/> You got your cantatination wrong, it should be like this:

local function tp(x, y, z)
  cb("/tp " .. x .. " " .. y .. " " .. z)
end
And actually, does something like that actually teleport a player? Shouldn't it be "/tp @p x y z"? In that case, use

local function tp(x, y, z)
  cb("/tp @p " .. x .. " " .. y .. " " .. z)
end