diff options
author | Dominick Allen <djallen@librehumanitas.org> | 2024-11-10 15:14:38 -0600 |
---|---|---|
committer | Dominick Allen <djallen@librehumanitas.org> | 2024-11-10 15:14:38 -0600 |
commit | 2b641aa2f4f5b894ceed8bf2a46fcef35e930d56 (patch) | |
tree | b5decb0fcd6a225c89d2ababb0fdf2d84b39a334 /src/luacxx.cpp | |
parent | 47e0ff88edd4660513f1d4f3d731008461532a13 (diff) |
Diffstat (limited to 'src/luacxx.cpp')
-rw-r--r-- | src/luacxx.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/luacxx.cpp b/src/luacxx.cpp index 0a6db82..c76bddc 100644 --- a/src/luacxx.cpp +++ b/src/luacxx.cpp @@ -9,9 +9,8 @@ namespace getsuyomi { using fud::FudStatus; -LuaContext::LuaContext() +LuaContext::LuaContext() : m_state{luaL_newstate()} { - m_state = luaL_newstate(); if (m_state != nullptr) { luaL_openlibs(m_state); } @@ -25,12 +24,12 @@ LuaContext::~LuaContext() } } -LuaContext::LuaContext(LuaContext&& rhs) : m_state{rhs.m_state} +LuaContext::LuaContext(LuaContext&& rhs) noexcept : m_state{rhs.m_state} { rhs.m_state = nullptr; } -LuaContext& LuaContext::operator=(LuaContext&& rhs) +LuaContext& LuaContext::operator=(LuaContext&& rhs) noexcept { if (m_state != nullptr) { lua_close(m_state); @@ -83,7 +82,7 @@ LuaResult<const char*> LuaContext::getGlobalString(const char* name) return LuaResult<const char*>::error(FudStatus::ObjectInvalid); } - size_t length; + size_t length{}; const char* result{nullptr}; auto luaType = lua_getglobal(m_state, name); @@ -114,10 +113,10 @@ LuaResult<std::vector<std::string>> LuaContext::getGlobalStringArray(const char* if (luaType != LUA_TTABLE) { lua_pop(m_state, 1); - return RetType::error(FudStatus::InvalidInput); + return RetType::error(FudStatus::ArgumentInvalid); } - int64_t length; + int64_t length{}; int isNumber{}; lua_len(m_state, -1); length = lua_tointegerx(m_state, -1, &isNumber); |