Lua script runs once and quits

Hi,

Silly question, but how do I run a Lua script continuously?

I’m sending OSC messages into TouchDesigner, and I need the info constantly updating. Within the built-in ‘Editor & Terminal’ I can execute the script but it runs once quits.

I’ve tried launching the script from my actual terminal but I get “permission denied”

The script is located inside the ‘User Scripts’ folder

Any tips will be appreciated:)

…maybe just use a while(true) loop…works great for games and stuff…

Your script indeed will run once and quit. Then, the Lua garbage collector will pick it up, and poof

So, once you go a little beyond simple fire-and-forget type scripts, I would suggest that you create a tool.

It’s a small step - create a folder containing a manifest.xml + main.lua and you’re good to go.

The tool lets you define variables that stick around, attach listeners and many other things.

Also look intorenoise.tool():add_timer