PDA

View Full Version : Loop not working



playmenow
04-12-2006, 09:48 AM
Hello. Please help me. I have a for loop that will load & execute script files that are in a table. I don't know where the problem is, as it loads only the first file. Here is the code:

Application --> On Startup


if File.DoesExist("AutoPlay\\Docs\\scripts.xml") == true then
Script = {}
XML.Load("AutoPlay\\Docs\\scripts.xml");
local names = XML.GetElementNames("pmn", false, false);
for h, p in names do
if p ~= "" then
Table.Insert(Script, h, XML.GetValue("pmn/"..p));
end
end
end


Page --> On Show


if Script ~= {} then
for t, lua in Script do
if lua ~= "" then
require("AutoPlay\\Docs\\"..lua);
end
end
Script = {}
end


I also upload an ACE archive that has the APZ file & the "almost working" application. Yes, it's only working to load the firsts file. Thank you!

http://www.rapidsharing.com/5ac8a5e14bfb2ff42752ca8a72ba115d