-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.lua
37 lines (30 loc) · 1.41 KB
/
init.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
local ie = minetest.request_insecure_environment()
if ie == nil and (debug.getupvalue == nil and debug.getlocal == nil) then
minetest.log("warning", [[
===== ATTENTION (this is mainly for servers)=======
Libox is not included in trusted mods,
this means that libox cannot measure local variables and upvalues inside coroutine sandboxes
(it needs debug.getlocal and debug.getupvalue to do it)
LIBOX WILL EXPOSE AND USE debug.getlocal AND debug.getupvalue
also MAKE SURE TO TRUST ALL MODS IF YOU MAKE LIBOX A TRUSTED MOD
(but also this is very hard to abuse unless your mods store the insecure environment somewhere)
If you don't use coroutine sandboxes, feel free to ignore this warning
Libox can also reuse debug.getlocal and getupvalue if it is already avaliable in the environment
========== ATTENTION END ==========
]])
elseif debug.getlocal == nil or debug.getupvalue == nil and ie ~= nil then
-- luacheck:ignore
debug.getlocal = ie.debug.getlocal
debug.getupvalue = ie.debug.getupvalue
end
ie = nil -- luacheck: ignore
local MP = minetest.get_modpath(minetest.get_current_modname())
dofile(MP .. "/main.lua")
-- Files that are executed sync only, coroutine.lua and *.test.lua
dofile(MP .. "/coroutine.lua")
-- async files
minetest.register_async_dofile(MP .. "/main.lua")
local test = MP .. "/test"
dofile(test .. "/basic_testing.lua")
dofile(test .. "/coroutine.test.lua")
dofile(test .. "/normal.test.lua")