Skip to content
Extraits de code Groupes Projets

Add a way to execute a Lua file with Vivy in a click-click way

Fusionnées Kubat a demandé de fusionner lua-exec vers master
2 files
+ 33
47
Comparer les modifications
  • Côte à côte
  • En ligne

Fichiers

+ 9
16
@@ -16,12 +16,10 @@
@@ -16,12 +16,10 @@
Create a new script. All the options and other stuff is defined in the
Create a new script. All the options and other stuff is defined in the
`.spek` file.
`.spek` file.
local script = Vivy:newScript {
local script = Vivy:newScript ("sample_script")
name = "sample_script", author = "Vivy", revision = "rev-1254"
}
A local function to the script may be used by another script with the
A local function to the script may be used by another script with the
"Vivy:getScript" function call.
"Vivy:import" function call.
All job functions take as first parameter the opt structure. This is really
All job functions take as first parameter the opt structure. This is really
usefull when calling multiple scripts on the same Vivy document with a
usefull when calling multiple scripts on the same Vivy document with a
@@ -29,26 +27,21 @@
@@ -29,26 +27,21 @@
Vivy according to the `.spek` file.
Vivy according to the `.spek` file.
]]
]]
local global = Vivy:global()
local global = Vivy:global ()
local utils = Vivy:getScript { script = "utils", author = "std" }
local script = Vivy:newScript ("sample-spec")
local script = Vivy:newScript {
local utils = Vivy:import { script = "utils" }
name = "sample_script",
local prettyPrint = Vivy:import { script = "utils", func = "prettyPrint" }
author = "Vivy",
revision = "rev-1254",
}
Vivy:newFunction ("tripleCopySyl", function (syl)
local tripleCopySyl = Vivy:newFunction ("tripleCopySyl", function (syl)
return { syl:copy(), syl:copy(), syl:copy() }
return { syl:copy(), syl:copy(), syl:copy() }
end)
end)
Vivy:newFunction ("printFoo", function ()
Vivy:newFunction ("printFoo", function () print "Bar" end)
print "Bar"
end)
Vivy:newJob ("retime_lines", Iterable.LINE, function (opt, line)
Vivy:newJob ("retime_lines", Iterable.LINE, function (opt, line)
line.start += opt.preTime
line.start += opt.preTime
line.finish += opt.postTime
line.finish += opt.postTime
if line.start <= 0 then line.start = 0; end
if line.start <= 0 then line.start = 0 end
if line.finish >= global.finish() then line.finish = global.finish() end
if line.finish >= global.finish() then line.finish = global.finish() end
return line
return line
end)
end)
Chargement en cours