rodecomp/Source/Script/NLuaState.cpp
ragnarok-clanker 9562207a4d Decompile 2 functions in Source/Script/NLuaState.cpp, Source/Script/NLuaState.h
Batch #3188 by eAthena: 0 byte-identical, 2 confirmed by peer review.

- fn_20941 NLuaState::NLuaState: logic confirmed by peer review
- fn_20944 NLuaThread::`scalar deleting destructor': logic confirmed by peer review

Reviewed-by: ragnarok-clanker
Adds to the build: Source/Script/NLuaState.cpp
2026-10-29 21:50:08 +00:00

35 lines
721 B
C++

#include "Script/NLuaState.h"
extern "C" {
#include <lauxlib.h>
#include <lua.h>
}
// OFFSET: 0x00CA4CF0
// FUNCTION: fn_20941
NLuaState::NLuaState() : m_state(nullptr), m_isValid(false) {
this->m_state = luaL_newstate();
if (this->m_state != nullptr) {
this->m_isValid = true;
}
}
NLuaState::~NLuaState() {
if (this->m_state != nullptr) {
lua_close(this->m_state);
this->m_state = nullptr;
}
}
NLuaThread::NLuaThread(NLuaState& parent) : m_state(nullptr), m_isValid(false) {
this->m_state = lua_newthread(parent.m_state);
if (this->m_state != nullptr) {
this->m_isValid = true;
}
}
// OFFSET: 0x00CA4E80
// FUNCTION: fn_20944
NLuaThread::~NLuaThread() {
this->m_state = nullptr;
}