Блог им. kurd
require("iuplua")
local interrupted
function OnStop()
interrupted = true
end
--[[
function sleep(n) -- standalone
if n > 0 then
os.execute("ping -n "..
tonumber(n) .." localhost > nul")
end
end
--]]
function main()
local btn1 = iup.button { title = "Show Dialog", }
function btn1:action()
local r = iup.Alarm("", "Main Title doesn't update!", "Exit")
if r == 1 then
interrupted = true
end
end -- btn1:action()
local btn2 = iup.button { title = "Show menu", }
function btn2:action()
local item = iup.item { title = "Exit", }
function item:action()
interrupted = true
end
local menu = iup.menu {
iup.item { title = "Dialog title doesn't update!",
active = "NO", }, item
}:popup(iup.MOUSEPOS, iup. <a name="cut"></a> MOUSEPOS)
end -- btn2:action()
local dlg = iup.dialog {
iup.vbox { btn1, btn2 };
size = "EIGHTHxEIGHTH",
}
function dlg:close_cb()
interrupted = true
end -- dlg:close_cb()
dlg:show()
local file = io.open("log.txt", "w+")
if file then
local pretime = 0
while not interrupted do
iup.LoopStep()
local curtime = os.time()
if pretime ~= curtime then
pretime = curtime
dlg.title = curtime
file:write (curtime, "\n")
--file:flush()
end
sleep(10) -- sleep(1) -- standalone
end
file:close()
end
dlg:destroy()
iup.Close()
message ("OK")
end -- main()
--main()-- standalone
--print "OK"
С-Л продолжает мелкие пакости. Исправьте его ляпсус на