Jump to content




[Lua][Error] attempt to call number


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

#1 Henness

  • Members
  • 189 posts

Posted 17 December 2012 - 09:32 PM

I'm close to finishing my program but I can't figure out this last bug

attempt to call number on line 311

https://github.com/H...vancedorefinder

#2 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 17 December 2012 - 09:46 PM

this is your naming conflict. you have a variable called face, and a function called face, it thinks you are trying to call the variable because of how lua does function pointers. I suggest that you try find/replace face( with something like setFace( (or whatever that function does, make you function names descriptive, coding standards say a function name should be a verb followed by a 1-3 word description of what it does).

#3 Henness

  • Members
  • 189 posts

Posted 17 December 2012 - 09:55 PM

Thanks

#4 KaoS

    Diabolical Coder

  • Members
  • 1,510 posts
  • LocationThat dark shadow under your bed...

Posted 17 December 2012 - 10:20 PM

well either that or a table storing the face value and a metatable so you can call it too. I like doing that as it keeps your variables organised

#5 Henness

  • Members
  • 189 posts

Posted 17 December 2012 - 10:34 PM

I hate tables :(
I'm getting attempt to compare string with number expected, got string on line 336

https://github.com/H...vancedorefinder

Thanks for all the help

#6 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 17 December 2012 - 10:46 PM

where is ofSave["l"] initialised? and is it actually a number being saved? (had a quick look and i could only see it being used)

#7 Henness

  • Members
  • 189 posts

Posted 17 December 2012 - 10:48 PM

line 435

#8 ChunLing

  • Members
  • 2,027 posts

Posted 17 December 2012 - 10:55 PM

You pass in tArgs[2] and make it length and then use it in runOreFinder() without changing it to number, so it's a string.

#9 Henness

  • Members
  • 189 posts

Posted 17 December 2012 - 11:00 PM

thanks I added some tonumber() to the tArgs

#10 Henness

  • Members
  • 189 posts

Posted 17 December 2012 - 11:33 PM

New problem and its not a error this time I'm getting closer. My problem is that the program is just ignoring my width and length variables. It just continues on and on in a strait line. And I have no Idea why it doesn't make sense.

https://github.com/H...vancedorefinder

#11 Henness

  • Members
  • 189 posts

Posted 18 December 2012 - 12:17 AM

Bump

#12 Henness

  • Members
  • 189 posts

Posted 18 December 2012 - 12:52 AM

View PostHenness, on 17 December 2012 - 11:33 PM, said:

New problem and its not a error this time I'm getting closer. My problem is that the program is just ignoring my width and length variables. It just continues on and on in a strait line. And I have no Idea why it doesn't make sense.

https://github.com/H...vancedorefinder

I finally got it there was a variable that was local that shouldn't have been.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users