OSL ‐ External Languages - Mistium/Origin-OS GitHub Wiki
Gaining permissions
In order to run other languages, you must first have permission from the user to do so.
You can request a permission like this:
permission "request" "permission_name"
Python
Getting the permission
permission "request" "python"
After this is accepted, you can check "window.permissions" and see if the array contains "python" using .contains()
Example:
permission "request" "python"
// ask the user for the python permission
authorised = false
// this variable will tell our program if the permission is given
mainloop:
// main frame loop, everything before this is only run once, at the start
if authorised.not (
// will only run if the authorised variable is false
if window.permissions.contains("python") (
// check if the python permission has been given
authorised = true
// set authorised to true
)
)
Running python
After the permission has been authorised you can run python using the command below:
py "print(\"hello world\")"
// runs python
log data
// logs "hello world"
Javascript
Getting the permission
You can do the exact same as with python for javascript, except using the "javascript" permission
Running Javascript
After the permission has been authorised you can run javascript using the command below:
eval "console.log(\"hello world\")"
// runs javascript, this outputs to the browser console