add 'test' library

This commit is contained in:
MihailRis
2024-12-07 22:16:50 +03:00
parent bbb9987140
commit 59402b6607
10 changed files with 56 additions and 12 deletions
+1
View File
@@ -37,6 +37,7 @@ extern const luaL_Reg packlib[];
extern const luaL_Reg particleslib[]; // gfx.particles
extern const luaL_Reg playerlib[];
extern const luaL_Reg quatlib[];
extern const luaL_Reg testlib[];
extern const luaL_Reg text3dlib[]; // gfx.text3d
extern const luaL_Reg timelib[];
extern const luaL_Reg tomllib[];
+5
View File
@@ -0,0 +1,5 @@
#include "api_lua.hpp"
const luaL_Reg testlib[] = {
{NULL, NULL}
};
+10 -7
View File
@@ -2,15 +2,18 @@
#include "window/Window.hpp"
#include "api_lua.hpp"
static int l_time_uptime(lua::State* L) {
return lua::pushnumber(L, Window::time());
using namespace scripting;
static int l_uptime(lua::State* L) {
return lua::pushnumber(L, engine->getUptime());
}
static int l_time_delta(lua::State* L) {
return lua::pushnumber(L, scripting::engine->getDelta());
static int l_delta(lua::State* L) {
return lua::pushnumber(L, engine->getDelta());
}
const luaL_Reg timelib[] = {
{"uptime", lua::wrap<l_time_uptime>},
{"delta", lua::wrap<l_time_delta>},
{NULL, NULL}};
{"uptime", lua::wrap<l_uptime>},
{"delta", lua::wrap<l_delta>},
{NULL, NULL}
};