Author |
Wierd Compile Error. |
Fattierob Vice Admiral
Joined: April 25, 2003 Posts: 4059
| Posted: 2006-11-14 18:56  
Well...I've been trying my hand at this LUA thing, and it's.....interesting to say the least. I've started to get into the somewhat more then basic tests that chromix has posted (namely, number 5 and 6) and i've run into a snag.
whenever I compile, I get this wierd error:
Exception class: EluaException
Exception Message: [string.
That message, telling me whats wrong. Totally helpful. I've tried messing around with the code a bit, I think it has something to do with the tables OR it's the IDE i'm using (LuaEdit) that, for some reason, doesn't think table.foreach(tab,print) isn't a method.
I'm just curious if it's some kind of bug...I mean feature in lua that throws those kinds of exceptions, or if I should go find a new IDE (I just hate coding in the LUA console box...)
_________________
|
Ospolos Grand Admiral
Joined: January 31, 2004 Posts: 567 From: ON, CANADA
| Posted: 2006-11-15 07:44  
The only problem I can see with 5 and 6 tossing that type of exception for that is when you use string.char(), and how you possibly used it. Send me it, ill try to execute it myself and come to a conclusion
[ This Message was edited by: Ospolos on 2006-11-15 08:16 ]
_________________ Honoured,
Osp
|
BackSlash Marshal Galactic Navy
Joined: March 23, 2003 Posts: 11183 From: Bristol, England
| Posted: 2006-11-15 10:43  
Upload it someplace and I'll see if I can compile it too.
_________________
|
Fattierob Vice Admiral
Joined: April 25, 2003 Posts: 4059
| Posted: 2006-11-15 15:15  
Well, I am using string.char(), and it compiles when it's not remmed, and when it's rem
I think the problem is actually trying to print what is in the array...
no, I found the problem. Trying to do a table.getn(t) makes an error. t is my current table, so I cannot figure out why it would do that
I am doing:
for i = 1, table.getn(t) do ...etc
that throws the [string. error
i've tried doing:
j = table.getn(t)
and it throws the same error. So something is wrong with my table...
It is defintly the getn(t) method. I cannot figure out WHY it is not working...
my table goes from 32 to 126.......
What bothers me the most is, however, that it's the most useless error message. Not even a line where the error [i]could[/b] be.
i'll PM you guys the code, because I don't want to get in trouble for posting it to the public
_________________
|
Ospolos Grand Admiral
Joined: January 31, 2004 Posts: 567 From: ON, CANADA
| Posted: 2006-11-15 16:29  
Ok rob, thanks, this is what I got from lua.exe:
lua.exe: fr.txt:12: attempt to index global `table' (a function value)
stack traceback:
fr.txt:12: in main chunk
[C]: ?
You have to rename your function you labeled "table()" to something else. When I made it ttable() for example, it worked.
Also. You may want to get in the habbit of using local variables for functions, and semi-colons to break the ends of code per line, just so you can also avoid certain errors and exceptions that could occur without thought.
Hope this helps you.
_________________ Honoured,
Osp
|
Fattierob Vice Admiral
Joined: April 25, 2003 Posts: 4059
| Posted: 2006-11-15 16:38  
*smacks head on table*
I forget to check the reserved list of words.........
thanks osp.
and I didn't know that you could put semi-colons in. I was kinda just free writing it without them o.O
_________________
|
Ospolos Grand Admiral
Joined: January 31, 2004 Posts: 567 From: ON, CANADA
| Posted: 2006-11-15 16:44  
edit: Edited Out.. Not really important.
[ This Message was edited by: Ospolos on 2006-11-15 21:02 ]
_________________ Honoured,
Osp
|