mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 19:11:50 +00:00
replace os.clock with preciser implementation
This commit is contained in:
parent
be4dda3646
commit
c7f35dd6be
3 changed files with 32 additions and 0 deletions
|
|
@ -8,6 +8,7 @@
|
|||
#include "engine/Engine.hpp"
|
||||
#include "devtools/DebuggingServer.hpp"
|
||||
#include "logic/scripting/scripting.hpp"
|
||||
#include "util/platform.hpp"
|
||||
|
||||
using namespace devtools;
|
||||
using namespace scripting;
|
||||
|
|
@ -381,6 +382,10 @@ static int l_debug_is_debugging(lua::State* L) {
|
|||
return lua::pushboolean(L, engine->getDebuggingServer() != nullptr);
|
||||
}
|
||||
|
||||
static int l_os_clock(lua::State* L) {
|
||||
return lua::pushnumber(L, platform::clock());
|
||||
}
|
||||
|
||||
void initialize_libs_extends(lua::State* L) {
|
||||
if (lua::getglobal(L, "debug")) {
|
||||
lua::pushcfunction(L, lua::wrap<l_debug_error>);
|
||||
|
|
@ -415,4 +420,11 @@ void initialize_libs_extends(lua::State* L) {
|
|||
|
||||
lua::pop(L);
|
||||
}
|
||||
|
||||
if (lua::getglobal(L, "os")) {
|
||||
lua::pushcfunction(L, lua::wrap<l_os_clock>);
|
||||
lua::setfield(L, "clock");
|
||||
|
||||
lua::pop(L);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue