10 posts
Posted 12 February 2013 - 06:15 PM
Title: area clearing program help
i am getting a error when running 'bios:338: [string "cleararea"]:11: '=' expected' Please help me fix this. Program pastebinned to Qga30r2L.
436 posts
Posted 13 February 2013 - 05:03 AM
You forgot your parentheses on line 10.
Quick tip: Whenever you run into an error, and nothing makes sense, go up and down two lines. The error. . . analyzer? . . . is not particularly accurate. It just knows there's a problem executing a specific line, and attempts to find out what is missing, if my comprehension is accurate.
2005 posts
Posted 13 February 2013 - 01:12 PM
It's accurate, just not very smart. Lua functions are just variables, so they can be assigned as well as being called. Because the loadstring is just checking to see if the code you've put into it is syntactically valid, it doesn't even know that the variable is a function, so it assumes you wanted to assign it something rather than call it. And since all whitespace is equivalent in Lua, it doesn't know that you've messed up till it gets a non-whitespace token that isn't syntactically valid on the next line.
There are two stages when running a program, first the program has to be turned into a function using loadstring, then it has to be run using pcall. Both of these will generate error messages, but they generate different types of messages. Often when you fix all the syntax errors (so that the loadstring stops complaining and loads your string), you'll start getting the pcall errors (like attempt to call nil, or index a function, or whatever) occurring earlier in the program than the errors you've already fixed. This can be frustrating if you don't realize that there are two different general categories of errors (syntax and other), and you don't start to see the other errors till all the syntax errors are resolved.
10 posts
Posted 13 February 2013 - 10:06 PM
thank you for your help im still a novie lua programer and will probably have more trouble but for now once again thank you