feat: implement the bDS2-compatible core Lua API
This commit is contained in:
3
docs/scripting/examples/macro.lua
Normal file
3
docs/scripting/examples/macro.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
function render(params, env)
|
||||
return "<strong>" .. (params.text or env.mainLanguage) .. "</strong>"
|
||||
end
|
||||
6
docs/scripting/examples/transform.lua
Normal file
6
docs/scripting/examples/transform.lua
Normal file
@@ -0,0 +1,6 @@
|
||||
function main(data, context)
|
||||
bds.app.toast("Imported from " .. context.source)
|
||||
data.tags = data.tags or {}
|
||||
table.insert(data.tags, "imported")
|
||||
return data
|
||||
end
|
||||
7
docs/scripting/examples/utility.lua
Normal file
7
docs/scripting/examples/utility.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
function main()
|
||||
local project = bds.projects.get_active()
|
||||
if project == nil then return { processed = 0 } end
|
||||
local posts = bds.posts.get_all()
|
||||
bds.report_progress({ current = #posts, total = #posts, message = "Complete" })
|
||||
return { processed = #posts }
|
||||
end
|
||||
Reference in New Issue
Block a user