Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/lcb/notes/19760.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# LiveCode Builder Standard Library

# [19760] Clarify forms of log syntax in documentation
32 changes: 21 additions & 11 deletions engine/src/engine.lcb
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,8 @@ begin
end syntax

/**
Summary: Logs a string.
String: The string to log.
Summary: Logs a value.
Value: The value to log.
Arguments: A list of arguments.

Example:
Expand All @@ -487,23 +487,33 @@ Example:

log "Widget %@ has id %@" with tList

Example:
variable tList as List
put [1,2,3,4] into tList
log tList

Description:
The log command triggers a logChanged message with the accumulated log messages since the logChanged message was last handled.
The log command triggers a logChanged message with the
accumulated log messages since the logChanged message
was last handled.
This can be handled in LiveCode Script, for example:
```
on logChanged pLog
write pLog to stdout
end logChanged
```

on logChanged pLog
write pLog to stdout
end logChanged

If using the 'with arguments' form, the <Value> must be a String.
Each occurrence of %@ in the String is replaced by a string
representation of subsequent values in the <Arguments> List.

Tags: Script Engine
*/

syntax Log is statement
"log" <Message: Expression> [ "with" <Arguments: Expression> ]
"log" <Value: Expression> [ "with" <Arguments: Expression> ]
begin
MCEngineExecLog(Message)
MCEngineExecLogWithValues(Message, Arguments)
MCEngineExecLog(Value)
MCEngineExecLogWithValues(Value, Arguments)
end syntax

/**
Expand Down