Jump to content




test:156: attempt to concatenate nil and string


  • You cannot reply to this topic
2 replies to this topic

#1 FuuuAInfiniteLoop(F.A.I.L)

  • Banned
  • 435 posts
  • LocationThe left part of this post

Posted 01 April 2013 - 05:02 AM

pastebin: pastebin.com/U39CNRRS
when i call the program with -receive it works but when i do it with send it gives me that error

the layout is the following(if you see it from the top)
C = computer
R = redstone

RRRRRRRRR
R R
C C

the redstone is connected at the back of the computer

#2 FuuuAInfiniteLoop(F.A.I.L)

  • Banned
  • 435 posts
  • LocationThe left part of this post

Posted 01 April 2013 - 05:10 AM

I put it on pastebin

#3 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 01 April 2013 - 05:12 AM

function toBinary(str)
	for i=1, #str do
		local a = getChar(str, i)
		local result = ""
		if a=="\n" then a = "end of line" end
		for k, v in pairs(binary) do
			if v==a then
				result = result..k
			end
		end
	end
	return result
end

Out of the whole code, that's like the only place you declare a local variable. Now this caused the error because result is nil when you return it, move the local result = "" out the for loop (above)

ANd yeah, start declaring functions/variables local :P





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users