PDA

View Full Version : for i,something in somelse do -- ERROR? or WHATs happening?



paul186
05-27-2010, 02:19 PM
Hi all, every time i have to do this code to search a string in a table like:
for i,something in somelse do

My app get error, why? is it a bug?

for example in this thread:
http://www.indigorose.com/forums/threads/28649-How-do-I-search-for-two-files-or-more/page2?highlight=search+multiple+files
i download the TEST.APZ maked by T3STY, opened it with ams8 and get the following error:

Error: Attempt to call a table value
Stack Traceback:
1:[Page1 -Z On Show]Line 3 in main chunk

and that line contains:


for i, drives in tDrives do


whats happening? and why is only in my AMS8? any idea of how can i solve it?

Thanks to all and sorry for this inconvenience.. im always asking you...

Ulrich
05-27-2010, 02:29 PM
Thanks to all and sorry for this inconvenience.. im always asking you...

You could check the documentation or search the forums before posting. This is clearly documented (http://www.indigorose.com/webhelp/ams/Scripting_Guide/Tables_(Arrays).htm#_Ref44926748) and has been discussed before.

Ulrich

Imagine Programming
05-27-2010, 03:08 PM
My browser now contains a macro for answering this question :p Nah, would be cool tho...


Change it to:
for i, drives in pairs(tDrives) do


You gotta use that in table loops as from Lua 5.1. Next time, read the documentation.

paul186
05-28-2010, 07:39 AM
My browser now contains a macro for answering this question :p Nah, would be cool tho...


Change it to:
for i, drives in pairs(tDrives) do


You gotta use that in table loops as from Lua 5.1. Next time, read the documentation.


thank you very much!. now it works perfect.

next time i will see documentation before asking, i didnt spect big differents from ams7 but now i see that i was wrong. AMS8 is cool!