Skip to main content

assert

Function assert 

Source
pub fn assert(v: any, message: option<string>) -> Repeatable<any>
Expand description

Raises an error if the value of its argument v is false (i.e. nil or false); otherwise, returns all its arguments. On error, message is used as the error object; when absent, it defaults to "assertion failed!".

local f = assert(io.open("config.txt"))  -- error if the open failed