Is there Lua External Scripting?

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

snoolord

  • Posts: 1
  • Joined: Sat Sep 30, 2023 12:24 pm
  • Real Name: winston zhao

Is there Lua External Scripting?

PostSat Sep 30, 2023 12:43 pm

Hi,
I'm trying to write an external lua script following the documentation in README.txt.
I am using a M1 Mac on Ventura 13.4.1 and the version of my DaVinci Resolve Studio is V18.5 Build 41.
I have been able to get the external scripting to work with python 3.11.3 but I was hoping that I would be able to use Lua instead.
I'm currently just trying to get a "Hello World" to work.
Code: Select all
resolve = Resolve()
projectManager = resolve:GetProjectManager()
project = projectManager:GetCurrentProject()
print("Project '"..project:GetName().."':")

and getting this issue ./packages/main/src/scripts/index.lua:1: attempt to call a nil value (global 'Resolve')

The code below works for python executing from the same directory. './packages/main/src/scripts/index.py'.
Code: Select all
#!/usr/bin/env python
import DaVinciResolveScript as dvr
resolve = dvr.scriptapp("Resolve")
fusion = resolve.Fusion()
project_manager = resolve.GetProjectManager()
project = project_manager.GetCurrentProject()
print(project.GetName())


I think there might be an environment variable issue as I've added the necessary variables, but think that maybe it's missing something like LUAPATH?
Code: Select all
    Mac OS X:
    RESOLVE_SCRIPT_API="/Library/Application Support/Blackmagic Design/DaVinci Resolve/Developer/Scripting"
    RESOLVE_SCRIPT_LIB="/Applications/DaVinci Resolve/DaVinci Resolve.app/Contents/Libraries/Fusion/fusionscript.so"
    PYTHONPATH="$PYTHONPATH:$RESOLVE_SCRIPT_API/Modules/"

Thanks in advance for the help,
A Noob at DaVinci Resolve Scripting
Offline
User avatar

Andrew Hazelden

  • Posts: 511
  • Joined: Sat Dec 06, 2014 12:10 pm
  • Location: West Dover, Nova Scotia, Canada

Re: Is there Lua External Scripting?

PostThu Oct 05, 2023 3:12 pm

snoolord wrote:I was hoping that I would be able to use Lua instead.
I'm currently just trying to get a "Hello World" to work


If you want to execute a Lua script externally and have it control Resolve Studio, Fusion Studio, or Fusion Render Node there is a command line scripting interface called "fuscript" that exists alongside the other BMD Resolve/Fusion program executables.

Code: Select all
fuscript CLI Syntax:
Usage: fuscript [opts] <script> [args]
   -i                   - Enter interactive mode
   -v                   - Print version information
   -s                   - Run as script server
   -S                   - Run as script server with no timeout
   -p [appname]         - Ping script apps
   -P [appname]         - Ping script apps (longer timeout)
   -q                   - Be quiet
   -b                   - Run with commandline debugger
   -l <lang>            - Explicitly set language, from:
      lua
      py2 or python2
      py3 or python3
   -x <string>          - Execute string


I did a few Apple Script examples that controlled fuscript and Lua a few years back:
https://github.com/AndrewHazelden/Fusio ... ne-Scripts

There are several fuscript usage examples on the Steakunderwater Fusion community forums:

Running UI Manager GUIs from a Terminal FuScript Session:
https://www.steakunderwater.com/wesuckl ... 498#p11498

Automating Reactor PathMaps on Fusion Render Nodes:
https://www.steakunderwater.com/wesuckl ... 807#p42807

[DEV] Using Fusion Studio as the Deadline Image Viewer:
https://www.steakunderwater.com/wesuckl ... 620#p42620

Fuscript Subtype Essentials:
https://www.steakunderwater.com/wesuckl ... 828#p20828

Fusion Comp Link Atom:
https://www.steakunderwater.com/wesuckl ... 996#p16996

https://gitlab.com/WeSuckLess/Reactor/- ... 20Link.lua
MacBook Air M1 / Threadripper 3990X | Fusion Studio 18.6 | Kartaverse 6

Return to Software Developers

Who is online

Users browsing this forum: Google [Bot] and 13 guests