Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
sztest
NodeCore
Commits
ee13585e
Commit
ee13585e
authored
Feb 06, 2020
by
Aaron Suen
Browse files
Experimental loading of license from disk.
parent
37763ce7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
1 deletion
+33
-1
mods/nc_player_gui/init.lua
mods/nc_player_gui/init.lua
+33
-1
No files found.
mods/nc_player_gui/init.lua
View file @
ee13585e
...
...
@@ -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
)
..
";1
1
,5.5;;;"
t
[
#
t
+
1
]
=
"textarea[0.5,"
..
(
y
+
0
.
25
)
..
";1
2
,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
]
=
"]"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment