-/*
- * Read template functions
- */
-template<>
-float ModApiBase::readParam(lua_State *L, int index)
-{
- if (isNaN(L, index))
- throw LuaError("NaN value is not allowed.");
+ DeprecatedHandlingMode dep_mode = get_deprecated_handling_mode();
+ if (dep_mode == DeprecatedHandlingMode::Ignore)
+ return func(L);
+
+ u64 start_time = porting::getTimeUs();
+ lua_Debug ar;
+
+ // Get caller name with line and script backtrace
+ FATAL_ERROR_IF(!lua_getstack(L, 1, &ar), "lua_getstack() failed");
+ FATAL_ERROR_IF(!lua_getinfo(L, "Sl", &ar), "lua_getinfo() failed");
+
+ // Get backtrace and hash it to reduce the warning flood
+ std::string backtrace = ar.short_src;
+ backtrace.append(":").append(std::to_string(ar.currentline));
+ u64 hash = murmur_hash_64_ua(backtrace.data(), backtrace.length(), 0xBADBABE);