|
TaskSandcat 4.0 adds the ability to launch Lua scripts in isolated processes. Sandcat Tasks can run independently or perform operations in an isolated tab process. The tasks can be monitored and managed from the Tasks page. Examples Example 1: HelloWorldTo launch a Sandcat Task, you need to use the tab:runtask() method (see the Task Object for more details about task methods). The runtask method needs a string parameter that must contain a Lua script to execute.
Example 2: Passing ParametersYou can supply a JSON string as a second parameter of the runtask() method if you want to pass parameters to the Sandcat Task, which you can later read using the params table or the param*() functions. This is exemplified below. mylauncher.lua - runs in the Sandcat Browser process:
mytask.lua - runs in an isolated process:
Example 3: Reporting SuccessYou can use the printsuccess() and printfailure() functions to print a line to the task log and paint the task status panel in green or red color.
|
© 2023 Syhunt |