Using Director > Writing Scripts with Lingo > Using handlers > Returning results from handlers

 

Returning results from handlers

Often you want a handler to report some condition or the result of some action.

To return results from a handler:

Use the return function to have a handler report a condition or the result of an action. For example, the following handler returns the current color of sprite 1:

on findColor
	return sprite(1).foreColor
end

When you define a handler that returns a result, you must use parentheses after the handler when you call it from another handler. For example, the statement put findColor() calls the on findColor handler and then displays the result in the Message window.