Alert

From codeTank

Jump to: navigation, search

Contents

Description

alert is a function used to display a simple popup window, with information, for the user. Note that alert is prefered over print in most cases. The purpose of print is to be used for debugging purposes - not for displaying information to the user.

Arguments

alert(text) -- title defaults to "Alert"
alert(text, title)

alert only takes one or two arguments. It applies tostring to each argument if it isn't already a string. The first argument is the text to be displayed in the alert window. If a second argument is present, then it's used to set the title of the window. If the second argument is omitted, then the default title is "Alert".

Returns

alert doesn't return anything.

Example

alert("Hello World!")
-- pops up "Hello World!" with "Alert" as the window title

alert("I am too awesome", "ERROR")
-- pops up "I am too awesome" with "ERROR" as the window title

See Also

Personal tools