Iuplua在MinGW里很难整,所以直接下个Lua for windows
,里面包含了Iuplua
执行脚本时需要把iup.dll放到工作目录,不然提示找不着dll。
main.lua
require "iuplua"
label = iup.label { title = "Hello Lua" }
button = iup.button { title = "OK" }
function btn_exit_cb()
return iup.CLOSE
end
vbox = iup.vbox {
label,
button,
alignment = "acenter",
gap = "10",
margin = "10x10"
}
dlg = iup.dialog {
vbox,
title = "Hello World"
}
button.action = btn_exit_cb
dlg:showxy(iup.CENTER, iup.CENTER)
if (iup.MainLoopLevel() == 0) then
iup.MainLoop()
iup.Close()
end