1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-05 18:41:05 +00:00

Change nil-component error to deprecation warning

This commit is contained in:
sfan5 2025-05-26 21:42:21 +02:00
parent 6ca9d75f0b
commit 5c2599315c
3 changed files with 12 additions and 9 deletions

View file

@ -30,10 +30,13 @@ static v3d check_v3d(lua_State *L, int index);
} \
} while(0)
// TODO: this should be turned into an error in 2026.
// Just revert the commit that added this line.
#define CHECK_NOT_NIL(index, name) do { \
if (lua_isnoneornil(L, (index))) { \
throw LuaError(std::string("Invalid ") + (name) + \
" (value is nil)."); \
auto msg = std::string("Invalid ") + (name) + \
" (value is nil)."; \
log_deprecated(L, msg, 1, true); \
} \
} while(0)

View file

@ -272,11 +272,11 @@ int ModApiEnv::l_get_node_raw(lua_State *L)
// mirrors the implementation of read_v3s16 (with the exact same rounding)
{
if (lua_isnoneornil(L, 1))
throw LuaError("X position is nil");
log_deprecated(L, "X position is nil", 1, true);
if (lua_isnoneornil(L, 2))
throw LuaError("Y position is nil");
log_deprecated(L, "Y position is nil", 1, true);
if (lua_isnoneornil(L, 3))
throw LuaError("Z position is nil");
log_deprecated(L, "Z position is nil", 1, true);
double x = lua_tonumber(L, 1);
double y = lua_tonumber(L, 2);
double z = lua_tonumber(L, 3);