even more boilerplate code

This commit is contained in:
MihailRis
2024-02-19 23:56:39 +03:00
parent 7792c1a6f4
commit 5c23b4125d
11 changed files with 220 additions and 72 deletions
+10
View File
@@ -4,6 +4,7 @@
#include "lua_util.h"
#include "api_lua.h"
#include "libgui.h"
#include "libplayer.h"
#include "libinventory.h"
#include "../../../util/stringutil.h"
@@ -172,6 +173,11 @@ int lua::LuaState::pushnumber(luanumber x) {
return 1;
}
int lua::LuaState::pushboolean(bool x) {
lua_pushboolean(L, x);
return 1;
}
int lua::LuaState::pushivec3(luaint x, luaint y, luaint z) {
lua::pushivec3(L, x, y, z);
return 3;
@@ -233,6 +239,10 @@ lua::luanumber lua::LuaState::tonumber(int idx) {
return lua_tonumber(L, idx);
}
const char* lua::LuaState::tostring(int idx) {
return lua_tostring(L, idx);
}
void lua::LuaState::openlib(const std::string& name, const luaL_Reg* libfuncs, int nup) {
lua_newtable(L);
luaL_setfuncs(L, libfuncs, nup);