aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/lua_api/l_util.cpp')
-rw-r--r--src/script/lua_api/l_util.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/script/lua_api/l_util.cpp b/src/script/lua_api/l_util.cpp
index d5adc7ab0..3f7e15acf 100644
--- a/src/script/lua_api/l_util.cpp
+++ b/src/script/lua_api/l_util.cpp
@@ -65,6 +65,14 @@ int ModApiUtil::l_log(lua_State *L)
return 0;
}
+// get_us_time()
+int ModApiUtil::l_get_us_time(lua_State *L)
+{
+ NO_MAP_LOCK_REQUIRED;
+ lua_pushnumber(L, porting::getTimeUs());
+ return 1;
+}
+
#define CHECK_SECURE_SETTING(L, name) \
if (name.compare(0, 7, "secure.") == 0) {\
lua_pushliteral(L, "Attempt to set secure setting.");\
@@ -368,6 +376,8 @@ void ModApiUtil::Initialize(lua_State *L, int top)
{
API_FCT(log);
+ API_FCT(get_us_time);
+
API_FCT(setting_set);
API_FCT(setting_get);
API_FCT(setting_setbool);
@@ -399,6 +409,8 @@ void ModApiUtil::InitializeAsync(AsyncEngine& engine)
{
ASYNC_API_FCT(log);
+ ASYNC_API_FCT(get_us_time);
+
//ASYNC_API_FCT(setting_set);
ASYNC_API_FCT(setting_get);
//ASYNC_API_FCT(setting_setbool);