-
Notifications
You must be signed in to change notification settings - Fork 0
Invoking External Function
A tinymoe programming cannot directly invoke the system's API, but the VM for tinymoe can. So programmers who embedding Tinymoe in their software may provide power functions to extend Tinymoe, these function will be written using the language that build that software (like C++).
If you registered an exteranl function into the Tinymoe VM, you can call it in any Tinymoe program using redirect to <expression>
. But there is an additional requirement: the <expression>
should be a string constant, which represents the registered name of the external function.
For example, a "Sqrt" function has already been registered to the Tinymoe VM, to invoke this function we should first declare it in Tinymoe:
phrase square root of (x)
redirect to "Sqrt"
end
redirect to <expression>
will pass every arguments of the current function to "Sqrt"
, and store the result in variable the result
. redirect to <expression>
will not end the function, so if you have special requirement that need to run before or after, you can just code it normally.