PDA

View Full Version : Lua wait for window ?



father of monstermagnet
November 16th, 2005, 11:58 PM
How can i wait for a window in Lua ?

I tried a while loop but had no success.

h = win.FindWindow("TkTopLevel",nil)
while h == nil
.
.
.

Thanks

Promixis
November 17th, 2005, 01:14 AM
that should do it.

what happens?

father of monstermagnet
November 18th, 2005, 06:48 AM
Nothing.

I get it working when i do a while loop with

win.IsWindowVisible

after the Findwindow.

But i have some strange behaviours with an other app that starts at the same
time (Even when i put a sleep inside the loop)

So i'm back to trigger the wait for window node.

BTW.

win.IsWindowVisible returns 1 if visible and false if invisible.

true and false or 0,nil and 1 fits better...or not ?

Same with i.e. win.IsZoomed(h)

birty
November 18th, 2005, 07:34 AM
in lua 0 is equivalent to false and non zero is equivalent to true

Promixis
November 18th, 2005, 08:21 AM
in lua 0 is equivalent to false and non zero is equivalent to true

Actually....

non true is either false or nil, everything else evaluates to true in an if statement.

so, unlike C, 0 is not false

birty
November 18th, 2005, 08:38 AM
i thought
if 0 then
do stuff
would not exexute the code?

Promixis
November 18th, 2005, 08:52 AM
i thought
if 0 then
do stuff
would not exexute the code?

if 0 then

end

always evaluates to true.