Commit ee13585e authored by Aaron Suen's avatar Aaron Suen
Browse files

Experimental loading of license from disk.

parent 37763ce7
......@@ -35,6 +35,38 @@ do
})
end
do
local insec = minetest.request_insecure_environment()
if insec then
local lpath = minetest.get_modpath(minetest.get_current_modname())
.. "/../../LICENSE"
local f = insec["io"].open(lpath)
if f then
local text = {}
local para
for l in function() return f:read("*line") end do
local t = l:match("^%s*(.-)%s*$")
if #t == 0 then
if para then text[#text + 1] = para end
text[#text + 1] = ""
para = ""
elseif para then
if #para > 0 then para = para .. " " end
para = para .. t
else
text[#text + 1] = t
end
end
if para then text[#text + 1] = para end
nodecore.register_inventory_tab({
title = "License",
content = text
})
f:close()
end
end
end
nodecore.register_inventory_tab({
title = "Inventory",
content = {
......@@ -113,7 +145,7 @@ function nodecore.inventory_formspec(player, curtab)
table_insert(t, 1, "size[12," .. 5.5 + y .. "]")
if f then
t[#t + 1] = "textarea[0.5," .. (y + 0.25) .. ";11,5.5;;;"
t[#t + 1] = "textarea[0.5," .. (y + 0.25) .. ";12,5.5;;;"
if type(f) == "function" then f = f(player) end
for i = 1, #f do t[#t + 1] = fse(nct(f[i]) .. "\n") end
t[#t + 1] = "]"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment