diff options
author | Elias Fleckenstein <54945686+EliasFleckenstein03@users.noreply.github.com> | 2020-11-04 16:44:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 16:44:42 +0100 |
commit | 5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc (patch) | |
tree | c980d614fec4a5495798be3e79e033229062c3cd /src/script/lua_api/l_base.cpp | |
parent | 28f6a79706b088c37268a59d90878220dc4ef9c7 (diff) | |
parent | 3af10766fd2b58b068e970266724d7eb10e9316b (diff) | |
download | dragonfireclient-5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc.tar.xz |
Merge branch 'master' into master
Diffstat (limited to 'src/script/lua_api/l_base.cpp')
-rw-r--r-- | src/script/lua_api/l_base.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/script/lua_api/l_base.cpp b/src/script/lua_api/l_base.cpp index 011434845..8ae03d6c8 100644 --- a/src/script/lua_api/l_base.cpp +++ b/src/script/lua_api/l_base.cpp @@ -32,9 +32,9 @@ ScriptApiBase *ModApiBase::getScriptApiBase(lua_State *L) lua_rawgeti(L, LUA_REGISTRYINDEX, CUSTOM_RIDX_SCRIPTAPI); ScriptApiBase *sapi_ptr; #if INDIRECT_SCRIPTAPI_RIDX - sapi_ptr = (ScriptApiBase*) *(void**)(lua_touserdata(L, -1)); + sapi_ptr = (ScriptApiBase *)*(void **)(lua_touserdata(L, -1)); #else - sapi_ptr = (ScriptApiBase*) lua_touserdata(L, -1); + sapi_ptr = (ScriptApiBase *)lua_touserdata(L, -1); #endif lua_pop(L, 1); return sapi_ptr; @@ -93,9 +93,8 @@ std::string ModApiBase::getCurrentModPath(lua_State *L) return mod->path; } - -bool ModApiBase::registerFunction(lua_State *L, const char *name, - lua_CFunction func, int top) +bool ModApiBase::registerFunction( + lua_State *L, const char *name, lua_CFunction func, int top) { // TODO: Check presence first! @@ -126,7 +125,7 @@ int ModApiBase::l_deprecated_function(lua_State *L) // Get parent class to get the wrappers map luaL_checktype(L, 1, LUA_TUSERDATA); void *ud = lua_touserdata(L, 1); - ModApiBase *o = *(ModApiBase**)ud; + ModApiBase *o = *(ModApiBase **)ud; // New function and new function name auto it = o->m_deprecated_wrappers.find(ar.name); @@ -136,12 +135,13 @@ int ModApiBase::l_deprecated_function(lua_State *L) backtrace.append(":").append(std::to_string(ar.currentline)); u64 hash = murmur_hash_64_ua(backtrace.data(), backtrace.length(), 0xBADBABE); - if (std::find(deprecated_logged.begin(), deprecated_logged.end(), hash) - == deprecated_logged.end()) { + if (std::find(deprecated_logged.begin(), deprecated_logged.end(), hash) == + deprecated_logged.end()) { deprecated_logged.emplace_back(hash); - warningstream << "Call to deprecated function '" << ar.name << "', please use '" - << it->second.name << "' at " << backtrace << std::endl; + warningstream << "Call to deprecated function '" << ar.name + << "', please use '" << it->second.name << "' at " + << backtrace << std::endl; if (m_error_deprecated_calls) script_error(L, LUA_ERRRUN, NULL, NULL); @@ -172,8 +172,8 @@ void ModApiBase::markAliasDeprecated(luaL_Reg *reg) // Do not inline struct. Breaks MSVC or is error-prone original_reg.name = last_name; original_reg.func = reg->func; - m_deprecated_wrappers.emplace( - std::pair<std::string, luaL_Reg>(reg->name, original_reg)); + m_deprecated_wrappers.emplace(std::pair<std::string, luaL_Reg>( + reg->name, original_reg)); reg->func = l_deprecated_function; } |