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

[Lua][Error] attempt to call number

Started by Henness, 17 December 2012 - 08:32 PM
Henness #1
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/Henness0666/Advanced-Programs/blob/master/advancedorefinder
theoriginalbit #2
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).
Henness #3
Posted 17 December 2012 - 09:55 PM
Thanks
KaoS #4
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
Henness #5
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/Henness0666/Advanced-Programs/blob/master/advancedorefinder

Thanks for all the help
theoriginalbit #6
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)
Henness #7
Posted 17 December 2012 - 10:48 PM
line 435
ChunLing #8
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.
Henness #9
Posted 17 December 2012 - 11:00 PM
thanks I added some tonumber() to the tArgs
Henness #10
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
Henness #11
Posted 18 December 2012 - 12:17 AM
Bump
Henness #12
Posted 18 December 2012 - 12:52 AM
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.