fix depctrl json not working

This commit is contained in:
garret 2022-03-28 19:37:09 +01:00
parent 050c3891b6
commit c22d9006a0
1 changed files with 10 additions and 6 deletions

View File

@ -5,20 +5,24 @@ script_version = "2.2.0"
script_namespace = "garret.dupe-and-comment" script_namespace = "garret.dupe-and-comment"
local haveDepCtrl, DependencyControl, depctrl = pcall(require, "l0.DependencyControl") local haveDepCtrl, DependencyControl, depctrl = pcall(require, "l0.DependencyControl")
local util local util, json
local json
if haveDepCtrl then if haveDepCtrl then
depctrl = DependencyControl { depctrl = DependencyControl {
--feed="TODO", --feed="TODO",
{"aegisub.util"}, {
{"json"} {"aegisub.util"},
{"json"}
}
} }
util, json = depctrl:requireModules() util, json = depctrl:requireModules()
else else
util = require 'aegisub.util' util = require 'aegisub.util'
local _
_, json = pcall(require, 'json') -- if you have depctrl, you have json, but even if you don't, you might have it anyway so worth checking
_ = nil
end end
json = require 'json' -- TODO: attempt to index upvalue 'json' (a nil value)
--inspect = require 'inspect' --inspect = require 'inspect'
function comment(subs, sel) function comment(subs, sel)