not loading new Paths in a loop or if statement

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Rickster
Posts: 291
Joined: Sun Oct 24, 2010 4:23 pm

not loading new Paths in a loop or if statement

#1 Post by Rickster » Tue Jan 31, 2012 7:20 pm

for example (pseudo code)

Code: Select all

count = 0;
while (true) do
	if count > 10 then
		loadPaths(wp_file);
	end;
	print(count);
	count++;
end;
expected behaviour:
when count is greater than 10 wp_file should be loaded and executed

whats happening
MM shows that wp_file has been loaded, but than executes the print statement and continues the loop, showing again and again that the new wp_file has been loaded and prints out "count" which than is greater than 10.

I tried this

Code: Select all

count = 0;
while (true) do
	if count > 10 then
		loadPaths(wp_file);
		error("Stop",0);
	end;
	print(count);
	count++;
end;
which ended up in MM showing that "wp_file" has been loaded, then breaks.
I expected the wp_file to be loaded and never reach the error statement.

I had this prob several time and thought it was a mistake in my coding ... maybe you can point it out to me.

How can i get MM to stop all things from the actual WP file when loading a new one.

kkulesza
Posts: 150
Joined: Fri May 27, 2011 9:00 pm
Location: Poland

Re: not loading new Paths in a loop or if statement

#2 Post by kkulesza » Tue Jan 31, 2012 8:10 pm

Code: Select all

	if count > 10 then
		loadPaths(wp_file);
		break;
	end;
Suggested reading -> http://www.lua.org/pil/4.4.html

Rickster
Posts: 291
Joined: Sun Oct 24, 2010 4:23 pm

Re: not loading new Paths in a loop or if statement

#3 Post by Rickster » Wed Feb 01, 2012 6:09 am

Reading confirmed ;)

This little "break" was the solution. Thanx!

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: not loading new Paths in a loop or if statement

#4 Post by rock5 » Wed Feb 01, 2012 7:26 am

Does ++ work in lua? I wasn't aware.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: not loading new Paths in a loop or if statement

#5 Post by lisa » Wed Feb 01, 2012 7:41 am

I generally do

Code: Select all

count = count + 1
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

Rickster
Posts: 291
Joined: Sun Oct 24, 2010 4:23 pm

Re: not loading new Paths in a loop or if statement

#6 Post by Rickster » Wed Feb 01, 2012 9:47 am

rock5 wrote:Does ++ work in lua? I wasn't aware.
i dont know, have not tested it. it was just kinda pseudo code to describe the prob, not a real working snippet.

User avatar
Administrator
Site Admin
Posts: 5330
Joined: Sat Jan 05, 2008 4:21 pm

Re: not loading new Paths in a loop or if statement

#7 Post by Administrator » Wed Feb 01, 2012 4:50 pm

rock5 wrote:Does ++ work in lua? I wasn't aware.
Nope. That should give a syntax error.

User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

Re: not loading new Paths in a loop or if statement

#8 Post by MiesterMan » Fri Feb 03, 2012 8:45 pm

Offtopic, but is it possible to overload operators in lua? (I'm guessing not)

Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 1 guest