mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-07 03:51:50 +00:00
add 'test' library
This commit is contained in:
parent
bbb9987140
commit
59402b6607
10 changed files with 56 additions and 12 deletions
|
|
@ -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
src/logic/scripting/lua/libs/libtest.cpp
Normal file
5
src/logic/scripting/lua/libs/libtest.cpp
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#include "api_lua.hpp"
|
||||
|
||||
const luaL_Reg testlib[] = {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
|
@ -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}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue