trevordevore wrote:You need to return the value, not get it.
Code: Select all
execute script "return the system weekdayNames"
I gave this syntax a try:
Code: Select all
variable tStringList as String
execute script "return the system weekdayNames"
put the result into tStringList
and I got this error from the engine:
"Value is not of correct type for assignment to variable - expected type livecode.lang.string for assigning to variable tStringList".
We can assume, "the result" contains nothing or not the value we are expecting or
the engine is failing to type the result "object" in this case.
Or, on the other hand we can assume I do not know how to get a result.
Anyway, I can't figure out how the engine could give a type to "the result" as the type is totally hidden until the execute command has been interpreted by the engine.
For example, the result could contain:
Code: Select all
execute script "return true" -- a boolean
execute script "return 1" -- an integer
execute script "return test" -- a string
And the developer would expected to get a string in all the cases.
As we can't give a type to "the result" ourself, the syntax for the execute script command would be:
execute script "myScript" as [Type]