Jump to content




[Lua][Error] Attempt to call a string


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

#1 wrothmonk

  • Members
  • 33 posts

Posted 16 February 2013 - 06:32 PM

EDIT: Solved problem, the function needed to be something else other than "craft".

I'm attempting to create a code for crafting tools in a crafty turtle. There is a function called "craft" in the code, when attempting to use it however, I get the error saying its not a function, but actually a string. edit: Actual error is "craft:(line the craft function was called during the program running): attempt to call string". So for crafting a sword it comes up with "craft:43: attempt to call string" and when crafting a pickaxe it comes up with "craft:53: attempt to call string".


craft
Spoiler

I've also run a test where it just calls the craft function and it came up with the same error with the line again being the line where the function was called.

part of code edited
Spoiler


#2 tesla1889

  • Members
  • 351 posts
  • LocationSt. Petersburg

Posted 16 February 2013 - 09:03 PM

what is dump defined as?

#3 LordIkol

  • Members
  • 197 posts
  • LocationSwitzerland

Posted 16 February 2013 - 09:07 PM

error must be somewhere else
i took the code generated dump and cleararea function as blank and it works.

i think dump removes the items in slot 15 and 16 and cleararea removes all items in slot 1 to 14

so if you want help please post the whole code so that we can figure out whats the problem.

Greets Loki

#4 wrothmonk

  • Members
  • 33 posts

Posted 17 February 2013 - 03:52 AM

Alright, updating the topic now, I didn't think you would need the rest as I assumed by the error it was a problem with defining the function.

#5 wrothmonk

  • Members
  • 33 posts

Posted 17 February 2013 - 06:46 AM

I cant believe I didnt try this earlier. Apparently theres something weird with attempting to make a function call craft(), I changed it to make() and it works perfectly now.

#6 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 17 February 2013 - 07:41 AM

View Postwrothmonk, on 17 February 2013 - 06:46 AM, said:

I cant believe I didnt try this earlier. Apparently theres something weird with attempting to make a function call craft(), I changed it to make() and it works perfectly now.

It's because defining a function called craft will overwrite all the turtle.craft() functions.





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users