Jump to content




failed to concatenate string and nil


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

#1 TR1T0N_

  • Members
  • 46 posts

Posted 17 May 2014 - 04:30 PM

Hello im current experiencing an error in a program that i designed a while ago however never finished the program errors on line 46 giving the error lua:46: attempt to concatenate string and nil and line 46 is rednet.send(1, "auth") so i dont understand how this is erroring any help would be much appreciated
p.s there proberly is alot more errors in this code as im currently debugging and finalizing it for release
Spoiler

Edited by TR1T0N_, 17 May 2014 - 04:31 PM.


#2 flaghacker

  • Members
  • 655 posts

Posted 17 May 2014 - 09:06 PM

You have to define your functions before your call them:
a("test")
function a(text)
   print(text)
end
--error
function a(text)
   print(text)
end
a("test")
--no error


#3 TR1T0N_

  • Members
  • 46 posts

Posted 18 May 2014 - 09:01 AM

but rednet.send() is already a function in the rednet api its already defined

#4 Goof

  • Members
  • 751 posts

Posted 18 May 2014 - 09:22 AM

...Well Its not the rednet.send() which is erroring... Its the function you're calling right after ( "get()")

And the function "get" isnt defined before its call...
I would say:
Move the "load" function to bottom of your script, then try again.

(like this:)
Spoiler

Hope it helps

#5 CometWolf

  • Members
  • 1,283 posts

Posted 18 May 2014 - 09:39 AM

The order of definition dosen't matter in this case. Because all his variables are global, and all the functions are defined prior to actually being called, since they are all called through the load function at the end.
line 46 is actually
print(var7..var8)
which is the result of line 45
var7, var8 = rednet.receive()
Given the error, we know that the second variable, var8, is nil.
What are you sending to the computer?

#6 TR1T0N_

  • Members
  • 46 posts

Posted 18 May 2014 - 09:47 AM

thanks alot for your help. kinda stupid mistake on my side but thanks for you help





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users