check-in of Lua script snippet to determine what program is running
authorNikolaus Gullotta <nikolaus.gullotta@gmail.com>
Tue, 31 Jul 2018 19:13:34 +0000 (14:13 -0500)
committerNikolaus Gullotta <nikolaus.gullotta@gmail.com>
Tue, 31 Jul 2018 19:13:34 +0000 (14:13 -0500)
scripts/s_whoami.lua [new file with mode: 0644]

diff --git a/scripts/s_whoami.lua b/scripts/s_whoami.lua
new file mode 100644 (file)
index 0000000..d391d65
--- /dev/null
@@ -0,0 +1,22 @@
+ardour { ["type"] = "Snippet", name = "Who Am I?" }
+
+function factory() return function()
+
+function whoami()
+       --pcall is the lua equivalent
+       --of try: ... catch: ...
+       if not pcall(function() local first_check = Session:get_mixbus(0) end) then
+               return "Ardour"
+       else
+               local second_check = Session:get_mixbus(11)
+               if second_check:isnil() then
+                       return "Mixbus"
+               else
+                       return "32C"
+               end
+       end
+end
+
+print(whoami())
+
+end end