Commit Graph

36 Commits

Author SHA1 Message Date
sfan5 033128d8dc Show better description to users when std::bad_alloc happens 2023-09-13 13:58:59 +02:00
rubenwardy c6a0ead72d
Add warning for initial properties directly inside definition (#9650) 2023-08-13 00:19:03 +01:00
Jude Melton-Houghton 0fc97a1483
Use a Lua error handler that calls tostring (#11913) 2022-12-15 07:37:49 -05:00
sfan5 e7659883cc Async environment for mods to do concurrent tasks (#11131) 2022-05-02 20:56:06 +02:00
sfan5 766e885a1b
Clean up/improve some scriptapi error handling code 2021-09-10 23:16:46 +02:00
SmallJoker 0c1e9603db
HUD: Reject and warn on invalid stat types (#11548)
This comes into play on older servers which do not know the "stat" type.
Warnings are only logged once to avoid spam within globalstep callbacks
2021-08-21 20:04:04 +02:00
rubenwardy 89dd05fdf3
Fix segfault in deprecation logging due to tail call, log by default (#10174) 2020-10-31 18:19:23 +00:00
HybridDog 4361bfcb4d
Fix configuration caching in log_deprecated (#9697)
* Fix configuration caching in log_deprecated

The configured variable was never set to true.
I've set the variables to thread_local because the configuration should be reloaded after reentering the world from mainmenu.
2020-04-22 00:07:12 +02:00
LNJ 307d7376cf
Fix 'the the' typos in comments (#9554) 2020-04-04 15:52:41 +02:00
sfan5 c657fb343f Refactor Script API's log_deprecated 2020-02-23 22:24:12 +01:00
Michael Muller ddd9317b73 Clean up stack after script_get_backtrace (#7854)
script_get_backtrace() was leaving its return value on the stack, corrupting
subsequent lua operations for functions that did not immediately return.

This problem can specifically be observed in the case of multiple "groupcaps"
entries, each of which provides the legacy "maxwear" property.  These cause a
backtrace and thus pollute the stack for the following lua_next() call.
2018-11-28 20:01:01 +01:00
nOOb3167 9537cfd3f8 Add a MSVC / Windows compatible snprintf function (#7353)
Use sizeof where applicable for mt_snprintf
2018-07-22 21:56:06 +02:00
SmallJoker a1598e1b83 Fix segfault in player migration and crash in log_deprecated
Makes log_deprecated work when triggered from no function
2018-05-14 21:19:52 +02:00
sfan5 813d819d15 Hint at problematic code when logging deprecated calls 2017-11-27 01:28:39 +00:00
red-001 f3ad75691a Create a filesystem abstraction layer for CSM and only allow accessing files that are scanned into it. (#5965)
* Load client-side mods into memory before executing them.

This removes the remaining filesystem access that client-sided mods had and it will hopefully make then more secure.

* Lua Virtual filesystem: don't load the files into memory just scan the filenames into memory.

* Fix the issues with backtrace

* fix most of the issues

* fix code style.

* add a comment
2017-06-30 20:14:39 +02:00
est31 836486a98e Fix crash regression when invsize formspec gets used
The invsize formspec element is outdated. Even though,
it is still supported, only a deprecation warning is shown,
introduced by commit [1]. The lua context passed to the
log_deprecated method added by commit [1] is NULL for the
invsize deprecation warning, as its run on the client and not
the server.

Commit [1] has removed checks for NULL inside the log_deprecated
method, resulting in a crash when a formspec with an invsize
element is parsed. This commit puts the check back.

Fixes #3260.

Referenced commits:

[1]: b5acec0a3c "Add proper lua api deprecated handling"

[2]: 7b8d372947 "Use warningstream for deprecated field messages and refactor log_deprecated"
2015-10-17 01:29:05 +02:00
ShadowNinja 7b8d372947 Use warningstream for deprecated field messages and refactor log_deprecated 2015-10-15 01:14:38 -04:00
Kahrl 3304e1e517 Push error handler afresh each time lua_pcall is used
Fixes "double fault" / "error in error handling" messages
(issue #1423) and instead shows a complete backtrace.
2015-08-27 01:56:06 +02:00
kwolekr 2b04ab874d SAPI: Track last executed mod and include in error messages 2015-08-12 23:56:12 -04:00
kwolekr 18cfd89a86 Display Lua memory usage at the time of Out-of-Memory error
Also misc. minor cleanups
2015-08-10 01:38:09 -04:00
kwolekr bcf47bc67c Improve Script CPP API diagnostics 2015-08-05 21:13:03 -04:00
ShadowNinja 3a8c788880 Add mod security
Due to compatibility concerns, this is temporarily disabled.
2015-05-16 18:32:31 -04:00
Craig Robbins 9527984dbc Move globals from main.cpp to more sane locations
Move debug streams to log.cpp|h

Move GUI-related globals to clientlauncher

Move g_settings and g_settings_path to settings.cpp|h

Move g_menuclouds to clouds.cpp|h

Move g_profiler to profiler.cpp|h
2015-04-01 23:04:25 +10:00
Craig Robbins ced6d20295 For usages of assert() that are meant to persist in Release builds (when NDEBUG is defined), replace those usages with persistent alternatives 2015-03-07 22:41:47 +10:00
Kahrl 3e267a6ece Fix LuaJIT exception wrapper 2014-08-23 20:41:03 +02:00
ShadowNinja c4359ff65c Use "core" namespace internally 2014-05-08 13:02:04 -04:00
sapier b5acec0a3c Add proper lua api deprecated handling 2014-04-29 22:49:04 +02:00
ShadowNinja 31fe72dbac Remove lua_State parameter from LuaError::LuaError 2014-03-15 16:28:59 -04:00
ShadowNinja f8b7555558 Revert "Make sure we get a stacktrace for as many lua errors as possible"
This reverts commit 362ef5f6ce.

Stack tracebacks couldn't be generated in LuaError::LuaError anyway and this
caused a second, empty traceback in most cases.  In cases where there wasn't
annother traceback the stack had already unwound and the traceback was empty.
2014-03-15 16:01:06 -04:00
Sfan5 362ef5f6ce Make sure we get a stacktrace for as many lua errors as possible 2014-03-15 14:51:00 +01:00
ShadowNinja 49cec3f782 Handle LuaErrors in Lua -> C++ calls on LuaJIT 2013-12-18 16:35:55 -05:00
ShadowNinja a0dce51af6 Move script_run_callbacks to Lua 2013-12-07 22:03:07 -05:00
kwolekr 5323d800cc Fix possible implicit conversion of NULL to std::string 2013-11-21 00:49:32 -05:00
ShadowNinja 371b39a09a Pass a errfunc to lua_pcall to get a traceback 2013-11-15 14:13:31 -05:00
Kahrl 4e1f50035e Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenu 2013-08-14 21:03:33 +02:00
sapier ab43377577 Move scriptapi to separate folder (by sapier)
On the lua side, notably minetest.env:<function>(<args>) should now
be replaced by minetest.<function>(<args>).
The old way is and will stay supported for a long time.

Also:
Update and clean up lua_api.txt (by celeron55)
Move EnvRef to lua and remove add_rat and add_firefly (by kahrl)
Add separate src/util/CMakeLists.txt, other minor fixes (by kahrl)
2013-05-25 00:51:02 +02:00