Jump to content




Attempt To Call Nil.


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

#1 NegativeZero6484

  • New Members
  • 1 posts

Posted 07 June 2014 - 11:16 AM

So I made a program to create a simple text, and it called nil. Can I have some help?

if true then
local monitor = peripheral.wrap ("back")
monitor.setTextscale(5)
monitor.setCursorPos(1,1)
monitor.write ("Boo")
end

Thanks for the help.

#2 CometWolf

  • Members
  • 1,283 posts

Posted 07 June 2014 - 08:01 PM

I forgot the term for it, but first word lower letters and then first letter capitalized for every word afterwards is considered conventional variable naming in Lua. The issue here is you did not do this with monitor.setTextScale(), as im sure the error number pointed to that lines aswell(3). Please include the full error next time, and use code tags.

Edited by CometWolf, 07 June 2014 - 08:01 PM.


#3 MKlegoman357

  • Members
  • 1,170 posts
  • LocationKaunas, Lithuania

Posted 07 June 2014 - 08:08 PM

View PostCometWolf, on 07 June 2014 - 08:01 PM, said:

I forgot the term for it...

Camelcase.

Code tags look like this:

[code]
print("Lua code")
[/code]

Translates to this:

print("Lua code")

Edited by MKlegoman357, 07 June 2014 - 08:08 PM.


#4 Link149

  • Members
  • 46 posts
  • LocationQuebec, Canada

Posted 08 June 2014 - 12:26 AM

View PostNegativeZero6484, on 07 June 2014 - 11:16 AM, said:

So I made a program to create a simple text, and it called nil. Can I have some help?

"attempt to call nil" usually means you tried to call an inexistant function.
Check whether you made any mistake in the function's name, if you didn't then it's
probably because the function was not defined at the line where this error occured.

As CometWolf said, It's probably because you did not capitalize the 'S' in "setTextScale".





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users