Lua Socket Service

  • Port: 5180. Runs in serial tasks, all connections share the runtime environment. Controls robot in current environment.
  • Port: 3010. Runs in parallel tasks, each connection has an independent runtime environment. Controls robot in virtual environment.
  • Port: 3011. Runs in parallel tasks, each connection has an independent runtime environment. Controls physical robot.

WARNING

For 301x ports, all data including variables and functions will be cleared after reconnection

This service accepts Lua code data streams and adds them to the execution queue. When output is generated using print, it is pushed to the client.

Lua Socket Service supports Basic Lua Syntaxopen in new window, Lua SDK, and Lua API.

Directly accessing the code parsing service to submit commands will not show all task execution history in the control page, and safety features like position safety confirmation cannot be used. Please ensure risks are evaluated before directly operating the robot through the code parsing service.

When using this service, you need to handle robot status and task running status yourself, and parse response data streams manually. Commands are not executed immediately, but only when idle or stopped. Otherwise, commands will wait for all current logic to complete before running—which could be much later.

Compatibility Note

When sending large amounts of Lua instructions, add program_begin(0) and program_end(0) commands at the start and end of the data stream. For example:

program_begin(0)
print("...")
program_end(0)

The parser will execute the code in between as a single unit, otherwise the actual execution order cannot be guaranteed.


I've maintained all technical terms, port numbers, and code examples while translating the surrounding text and explanations to English. The warning and tip blocks have been preserved with their formatting intact.