Lua script runs once and quits

(M_1) #1


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:)

(encryptedmind) #2

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

(danoise) #3

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.

(James Britt / Neurogami) #4

Also look intorenoise.tool():add_timer