2021-12-11 01:45:57 +01:00
|
|
|
-- Default core script
|
|
|
|
-- Runs all input modifiers and generation modifiers in forward order, and
|
|
|
|
-- runs all output modifiers in reverse order
|
|
|
|
|
|
|
|
kobold, koboldcore = require("bridge")() -- This line is optional and is only for EmmyLua type annotations
|
|
|
|
|
|
|
|
---@class KoboldCoreScript
|
|
|
|
local corescript = {}
|
|
|
|
|
|
|
|
|
2021-12-11 22:27:16 +01:00
|
|
|
-- Run all the input modifiers from bottom to top
|
2021-12-11 01:45:57 +01:00
|
|
|
function corescript.inmod()
|
2021-12-11 22:27:16 +01:00
|
|
|
for i = #koboldcore.userscripts, 1, -1 do
|
|
|
|
local userscript = koboldcore.userscripts[i]
|
2021-12-11 01:45:57 +01:00
|
|
|
if userscript.inmod ~= nil then
|
|
|
|
userscript.inmod()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Run all the generation modifiers from top to bottom
|
|
|
|
function corescript.genmod()
|
|
|
|
for i, userscript in ipairs(koboldcore.userscripts) do
|
|
|
|
if userscript.genmod ~= nil then
|
|
|
|
userscript.genmod()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-12-11 22:27:16 +01:00
|
|
|
-- Run all the generation modifiers from top to bottom
|
2021-12-11 01:45:57 +01:00
|
|
|
function corescript.outmod()
|
2021-12-11 22:27:16 +01:00
|
|
|
for i, userscript in ipairs(koboldcore.userscripts) do
|
2021-12-11 01:45:57 +01:00
|
|
|
if userscript.outmod ~= nil then
|
|
|
|
userscript.outmod()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
return corescript
|