remove startup and update stratumdblib

This commit is contained in:
2026-04-06 15:17:25 -07:00
parent 9817ebc244
commit c87a55ae3f
3 changed files with 15 additions and 11 deletions

12
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,12 @@
{
"Lua.workspace.library": [
"/home/ruffles/.vscode/extensions/pawz.polytoria-lua-1.1.1/api",
"${addons}/cc-tweaked/module/library"
],
"Lua.runtime.version": "Lua 5.3",
"Lua.runtime.builtin": {
"io": "disable",
"os": "disable"
},
"Lua.workspace.checkThirdParty": false
}

View File

@@ -1,7 +0,0 @@
local stratum = require("stratumDBlib")
local backend = require("meshnetBackend")
backend.setTarget(10)
stratum.setBackend(backend)
local trans = stratum.loadTransforms("transforms","stratumDBlib")
trans.test()
print(trans.add(5,10))

View File

@@ -97,9 +97,9 @@ function stratum.loadTransforms(modules,libpath)
file.close() file.close()
if not contents then error("failed to read file",2) end if not contents then error("failed to read file",2) end
contents = stratum.applyMacros(contents,libpath) contents = stratum.applyMacros(contents,libpath)
local func, err = load(contents,"transforms","t",_ENV) local trans, err = load(contents,"transforms","t",_ENV)
if not func then error(err,2) end if not trans then error(err,2) end
return func() return trans()
end end
function stratum.setBackend(backend) function stratum.setBackend(backend)
@@ -109,7 +109,6 @@ function stratum.setBackend(backend)
end end
function stratum.createTransform(name,func) function stratum.createTransform(name,func)
print("registering "..name)
local backend = _STRATUMBACKEND local backend = _STRATUMBACKEND
if not backend or not (backend.sendMessage and backend.receiveMessage) then error("stratum backend not defined or defined incorrectly",2) end if not backend or not (backend.sendMessage and backend.receiveMessage) then error("stratum backend not defined or defined incorrectly",2) end
backend.sendMessage({protocol="RegisterTransform",name=name,functionBody=func}) backend.sendMessage({protocol="RegisterTransform",name=name,functionBody=func})