|  Developer
Updated on November 10, 2021

hub.scenes.scripts.get

  • Version: 1.0
  • Classes: UI
  • Title: Scene manager categories
  • Description: Get content of a script snippet
Edit
Field Type Required Description
_id string + Id of a script snippet to get
Edit
Field Type Required Description
_id string + Id of a script snippet
code string + Lua code snippet
name string Title for the script snippet
Edit
Code Message Data
-32600 Wrong params,
-32600 Anonymous plugin doesn’t exist!
Edit
Here is it an example of usage:
Edit
				
					{
   "id":"_ID_",
   "jsonrpc":"2.0",
   "method":"hub.scenes.scripts.get",
   "params":{
      "_id":"5cf0dc8c7f000068d223e88a"
   }
}				
			
Edit
				
					{
    "error": null,
    "id": "_ID_",
    "result": {
        "_id": "5cf0dc8c7f000068d223e88a",
        "name":"Switch on all lights",
        "code": "require \"core\"\n local items = core.get_items()\n if items then \n \n for _, item in ipairs( items ) do\n core.set_item_value( item._id, true ) \n  end\n end"
    }
}