The code used by LiveCode is simple but more verbose than other languages.

You can't write a program using just a script, you have to create an interface of at least one stack, then add code to it.

Every window is called a stack, the area inside the border of a window is called a card. You can totally change the appearance of a window creating a new card.

Every card can contain any number of objects: buttons, images, tables, and etc.

This image of the project browser shows LiveCode hierarchy:


Project browser

Code can be inserted inside handlers attached to a stack, a card or an object.

LiveCode is different from other languages, in that it is strongly user oriented, so code isn't executed from the top to the bottom of the script.

☀On the contrary, code is initiated by messages arising by actions of the user or by parts of the program itself. These messages are then handled by code, contained in handlers, which are collected together into scripts.

These handlers are usually of the form...

on <message>
    do some clever stuff here
end <message>

For example if we want to create a button that shows a new window with "Hello world!". Well, just drag and drop a button in our stack, right click on it and select "edit script" (this will activate the code editor) and add the following code:

on mouseUp
  answer "Hello world!"
end mouseUp

This script contains the handler "on mouseup" which will respond to the mouseUp message that is sent at the end of a mouse button click.


Hello word example

Before proceeding let's see the basics.

Basic conceptsEdit

Advanced conceptsEdit

Programming structuresEdit

  • if
  • switch
  • repeat (while, until, for n times, for to step, for each, ...)
Community content is available under CC-BY-SA unless otherwise noted.