First commit
This commit is contained in:
commit
5194081791
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[submodule "StackTracePlus"]
|
||||||
|
path = StackTracePlus
|
||||||
|
url = https://github.com/ignacio/StackTracePlus.git
|
31
README.md
Normal file
31
README.md
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# StackTracePlus Minetest mod
|
||||||
|
|
||||||
|
StackTracePlus is a Lua module that extends `debug.traceback` to include more
|
||||||
|
call frame information such as local and globals, locals and parameters
|
||||||
|
dumps.
|
||||||
|
|
||||||
|
This mod merely plugs this module in and replaces `debug.traceback` with
|
||||||
|
StackTracePlus's traceback dump routine.
|
||||||
|
|
||||||
|
# Installing
|
||||||
|
|
||||||
|
This repository uses git submodules.
|
||||||
|
|
||||||
|
Clone this repo either recursively (`--recursive`) or as usual, but make sure
|
||||||
|
to `git submodule update --init` afterwards; it must go into the `mods`
|
||||||
|
directory.
|
||||||
|
|
||||||
|
## Mod security
|
||||||
|
|
||||||
|
This mod modifies the global `debug` table which is not accessible by normal
|
||||||
|
mods when mod security is enabled.
|
||||||
|
|
||||||
|
If you have enabled mod security (`secure.enable_security` is `true`), then you
|
||||||
|
must whitelist this mod in `minetest.conf`'s `secure.trusted_mods` config
|
||||||
|
entry.
|
||||||
|
|
||||||
|
# License
|
||||||
|
|
||||||
|
WTFPL / CC0 / Public Domain.
|
||||||
|
|
||||||
|
StackTracePlus is distributed under the MIT license.
|
1
StackTracePlus
Submodule
1
StackTracePlus
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 9b4aef95854ad0cf549850cee6dbd0fef5a82bf6
|
29
init.lua
Normal file
29
init.lua
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
local secenv = _G
|
||||||
|
local modname = minetest.get_current_modname()
|
||||||
|
local sec = (minetest.setting_get('secure.enable_security') == 'true')
|
||||||
|
local ie
|
||||||
|
if sec then
|
||||||
|
ie = minetest.request_insecure_environment()
|
||||||
|
if ie == nil then
|
||||||
|
error("Mod security is on but " .. modname .. " is not whitelisted as a secure mod")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if sec then
|
||||||
|
string, io, debug, coroutine = ie.string, ie.io, ie.debug, ie.coroutine
|
||||||
|
end
|
||||||
|
|
||||||
|
local STP = dofile(minetest.get_modpath(modname) .. '/StackTracePlus/src/StackTracePlus.lua')
|
||||||
|
-- Remove string/table dump length limits
|
||||||
|
STP.max_tb_output_len = math.huge
|
||||||
|
|
||||||
|
if sec then
|
||||||
|
ie.debug.traceback = STP.stacktrace
|
||||||
|
-- StackTracePlus caches the following modules, reset them to the original ones to
|
||||||
|
-- avoid leaking them
|
||||||
|
string, io, debug, coroutine = secenv.string, secenv.io, secenv.debug, secenv.coroutine
|
||||||
|
ie = nil
|
||||||
|
end
|
||||||
|
debug.traceback = STP.stacktrace
|
||||||
|
|
||||||
|
minetest.log('action', "[" .. modname .. "] replaced debug.traceback")
|
Loading…
Reference in New Issue
Block a user