Fork of Tangara with customizations
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
tangara-fw/src/ui/screen_lua.cpp

32 lines
550 B

/*
* Copyright 2023 jacqueline <me@jacqueline.id.au>
*
* SPDX-License-Identifier: GPL-3.0-only
*/
#include "screen_lua.hpp"
#include "lauxlib.h"
#include "lua.h"
#include "lua.hpp"
#include "luavgl.h"
namespace ui {
namespace screens {
Lua::Lua() : s_(nullptr), obj_ref_() {}
Lua::~Lua() {
if (s_ && obj_ref_) {
luaL_unref(s_, LUA_REGISTRYINDEX, *obj_ref_);
}
}
auto Lua::SetObjRef(lua_State* s) -> void {
assert(s_ == nullptr);
s_ = s;
obj_ref_ = luaL_ref(s, LUA_REGISTRYINDEX);
}
} // namespace screens
} // namespace ui