diff --git a/docs/lcb/notes/19760.md b/docs/lcb/notes/19760.md new file mode 100644 index 00000000000..c03abaab164 --- /dev/null +++ b/docs/lcb/notes/19760.md @@ -0,0 +1,3 @@ +# LiveCode Builder Standard Library + +# [19760] Clarify forms of log syntax in documentation diff --git a/engine/src/engine.lcb b/engine/src/engine.lcb index 52ad57a7cc2..cd44de7466d 100644 --- a/engine/src/engine.lcb +++ b/engine/src/engine.lcb @@ -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: @@ -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 must be a String. +Each occurrence of %@ in the String is replaced by a string +representation of subsequent values in the List. + Tags: Script Engine */ syntax Log is statement - "log" [ "with" ] + "log" [ "with" ] begin - MCEngineExecLog(Message) - MCEngineExecLogWithValues(Message, Arguments) + MCEngineExecLog(Value) + MCEngineExecLogWithValues(Value, Arguments) end syntax /**