mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-30 16:20:21 +00:00
Merge branch 'lua_real_time' into 'master'
[Lua] core.getRealTime() See merge request OpenMW/openmw!1880
This commit is contained in:
commit
e64b8d1fbb
@ -1,5 +1,7 @@
|
|||||||
#include "luabindings.hpp"
|
#include "luabindings.hpp"
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
|
||||||
#include <components/lua/luastate.hpp>
|
#include <components/lua/luastate.hpp>
|
||||||
#include <components/lua/l10n.hpp>
|
#include <components/lua/l10n.hpp>
|
||||||
|
|
||||||
@ -23,6 +25,10 @@ namespace MWLua
|
|||||||
api["getGameTime"] = [world=context.mWorldView]() { return world->getGameTime(); };
|
api["getGameTime"] = [world=context.mWorldView]() { return world->getGameTime(); };
|
||||||
api["getGameTimeScale"] = [world=context.mWorldView]() { return world->getGameTimeScale(); };
|
api["getGameTimeScale"] = [world=context.mWorldView]() { return world->getGameTimeScale(); };
|
||||||
api["isWorldPaused"] = [world=context.mWorldView]() { return world->isPaused(); };
|
api["isWorldPaused"] = [world=context.mWorldView]() { return world->isPaused(); };
|
||||||
|
api["getRealTime"] = []()
|
||||||
|
{
|
||||||
|
return std::chrono::duration<double>(std::chrono::steady_clock::now().time_since_epoch()).count();
|
||||||
|
};
|
||||||
|
|
||||||
if (!global)
|
if (!global)
|
||||||
return;
|
return;
|
||||||
|
@ -46,6 +46,11 @@
|
|||||||
-- @function [parent=#core] isWorldPaused
|
-- @function [parent=#core] isWorldPaused
|
||||||
-- @return #boolean
|
-- @return #boolean
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Real time in seconds; starting point is not fixed (can be time since last reboot), use only for measuring intervals. For Unix time use `os.time()`.
|
||||||
|
-- @function [parent=#core] getRealTime
|
||||||
|
-- @return #number
|
||||||
|
|
||||||
---
|
---
|
||||||
-- Get a GMST setting from content files.
|
-- Get a GMST setting from content files.
|
||||||
-- @function [parent=#core] getGMST
|
-- @function [parent=#core] getGMST
|
||||||
|
Loading…
x
Reference in New Issue
Block a user