aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/script/lua_api/l_env.cpp9
-rw-r--r--src/script/lua_api/l_env.h3
-rw-r--r--src/script/lua_api/l_util.cpp12
-rw-r--r--src/script/lua_api/l_util.h3
4 files changed, 15 insertions, 12 deletions
diff --git a/src/script/lua_api/l_env.cpp b/src/script/lua_api/l_env.cpp
index 2645c8007..6ffca6f0f 100644
--- a/src/script/lua_api/l_env.cpp
+++ b/src/script/lua_api/l_env.cpp
@@ -938,14 +938,6 @@ int ModApiEnvMod::l_forceload_free_block(lua_State *L)
return 0;
}
-// get_us_time()
-int ModApiEnvMod::l_get_us_time(lua_State *L)
-{
- NO_MAP_LOCK_REQUIRED;
- lua_pushnumber(L, porting::getTimeUs());
- return 1;
-}
-
void ModApiEnvMod::Initialize(lua_State *L, int top)
{
API_FCT(set_node);
@@ -987,5 +979,4 @@ void ModApiEnvMod::Initialize(lua_State *L, int top)
API_FCT(transforming_liquid_add);
API_FCT(forceload_block);
API_FCT(forceload_free_block);
- API_FCT(get_us_time);
}
diff --git a/src/script/lua_api/l_env.h b/src/script/lua_api/l_env.h
index 4f204da81..8354379f3 100644
--- a/src/script/lua_api/l_env.h
+++ b/src/script/lua_api/l_env.h
@@ -168,9 +168,6 @@ private:
// stops forceloading a position
static int l_forceload_free_block(lua_State *L);
- // get us precision time
- static int l_get_us_time(lua_State *L);
-
public:
static void Initialize(lua_State *L, int top);
};
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);
diff --git a/src/script/lua_api/l_util.h b/src/script/lua_api/l_util.h
index 4b55b1966..68c24520c 100644
--- a/src/script/lua_api/l_util.h
+++ b/src/script/lua_api/l_util.h
@@ -41,6 +41,9 @@ private:
// The two-argument version accept a log level: error, action, info, or verbose.
static int l_log(lua_State *L);
+ // get us precision time
+ static int l_get_us_time(lua_State *L);
+
// setting_set(name, value)
static int l_setting_set(lua_State *L);