mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
lua api refactor
This commit is contained in:
parent
5309cbe67f
commit
6bf6e8e011
20 changed files with 663 additions and 710 deletions
21
src/logic/scripting/lua/libtime.cpp
Normal file
21
src/logic/scripting/lua/libtime.cpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "api_lua.h"
|
||||
#include "lua_commons.h"
|
||||
#include "../scripting.h"
|
||||
#include "../../../engine.h"
|
||||
#include "../../../window/Window.h"
|
||||
|
||||
static int l_time_uptime(lua_State* L) {
|
||||
lua_pushnumber(L, Window::time());
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int l_time_delta(lua_State* L) {
|
||||
lua_pushnumber(L, scripting::engine->getDelta());
|
||||
return 1;
|
||||
}
|
||||
|
||||
const luaL_Reg timelib [] = {
|
||||
{"uptime", lua_wrap_errors<l_time_uptime>},
|
||||
{"delta", lua_wrap_errors<l_time_delta>},
|
||||
{NULL, NULL}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue