Test
This commit is contained in:
@@ -198,4 +198,5 @@ function basalt.getAPI(name)
|
|||||||
return elementManager.getAPI(name)
|
return elementManager.getAPI(name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
return basalt
|
return basalt
|
||||||
@@ -1,3 +1,27 @@
|
|||||||
|
local function serialize(t, indent)
|
||||||
|
indent = indent or ""
|
||||||
|
local result = "{\n"
|
||||||
|
for k, v in pairs(t) do
|
||||||
|
result = result .. indent .. " "
|
||||||
|
|
||||||
|
if type(k) == "string" then
|
||||||
|
result = result .. "[\"" .. k .. "\"] = "
|
||||||
|
else
|
||||||
|
result = result .. "[" .. k .. "] = "
|
||||||
|
end
|
||||||
|
|
||||||
|
if type(v) == "table" then
|
||||||
|
result = result .. serialize(v, indent .. " ")
|
||||||
|
elseif type(v) == "string" then
|
||||||
|
result = result .. "\"" .. v .. "\""
|
||||||
|
else
|
||||||
|
result = result .. tostring(v)
|
||||||
|
end
|
||||||
|
result = result .. ",\n"
|
||||||
|
end
|
||||||
|
return result .. indent .. "}"
|
||||||
|
end
|
||||||
|
|
||||||
local function scanDir(dir)
|
local function scanDir(dir)
|
||||||
local files = {}
|
local files = {}
|
||||||
for file in io.popen('find "'..dir..'" -type f -name "*.lua"'):lines() do
|
for file in io.popen('find "'..dir..'" -type f -name "*.lua"'):lines() do
|
||||||
@@ -23,5 +47,5 @@ local config = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local f = io.open("config.lua", "w")
|
local f = io.open("config.lua", "w")
|
||||||
f:write("return " .. textutils.serialize(config))
|
f:write("return " .. serialize(config))
|
||||||
f:close()
|
f:close()
|
||||||
|
|||||||
Reference in New Issue
Block a user