Comprehensive Windows framework to develop in Lua
modules > ui > warn

ui.warn (msg , [title] )

Displays a warning message dialog box with an exclamation-point icon, and waits for the user to click the OK button.



A string that indicates the message to display to the user.


An optional string that indicates the title of the message dialog box (defaulting to "Warning")

Return value

This function returns the string "ok" once the user has pressed the OK button or after having closed the dialog.


local ui = require "ui"

-- create a new Pipe to capture output of the "WMIC PATH Win32_Battery Get EstimatedChargeRemaining" command
local pipe = sys.Pipe('cmd.exe /K "WMIC PATH Win32_Battery Get EstimatedChargeRemaining"')

-- wait one second for output

-- capture output
local charge = pipe:read():match("%d+")

-- Displays current battery remaining charge
ui.warn("Battery left : "..charge.."%", "Battery remainging charge")