aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/lua_api')
-rw-r--r--src/script/lua_api/l_server.cpp12
-rw-r--r--src/script/lua_api/l_server.h3
-rw-r--r--src/script/lua_api/l_util.h2
3 files changed, 16 insertions, 1 deletions
diff --git a/src/script/lua_api/l_server.cpp b/src/script/lua_api/l_server.cpp
index 85314a3bc..59d3f5c70 100644
--- a/src/script/lua_api/l_server.cpp
+++ b/src/script/lua_api/l_server.cpp
@@ -45,6 +45,16 @@ int ModApiServer::l_get_server_status(lua_State *L)
return 1;
}
+// print(text)
+int ModApiServer::l_print(lua_State *L)
+{
+ NO_MAP_LOCK_REQUIRED;
+ std::string text;
+ text = luaL_checkstring(L, 1);
+ getServer(L)->printToConsoleOnly(text);
+ return 0;
+}
+
// chat_send_all(text)
int ModApiServer::l_chat_send_all(lua_State *L)
{
@@ -505,6 +515,8 @@ void ModApiServer::Initialize(lua_State *L, int top)
API_FCT(get_modpath);
API_FCT(get_modnames);
+ API_FCT(print);
+
API_FCT(chat_send_all);
API_FCT(chat_send_player);
API_FCT(show_formspec);
diff --git a/src/script/lua_api/l_server.h b/src/script/lua_api/l_server.h
index df31f325f..06a5ddc24 100644
--- a/src/script/lua_api/l_server.h
+++ b/src/script/lua_api/l_server.h
@@ -46,6 +46,9 @@ private:
// the returned list is sorted alphabetically for you
static int l_get_modnames(lua_State *L);
+ // print(text)
+ static int l_print(lua_State *L);
+
// chat_send_all(text)
static int l_chat_send_all(lua_State *L);
diff --git a/src/script/lua_api/l_util.h b/src/script/lua_api/l_util.h
index 68c24520c..6fac7e7eb 100644
--- a/src/script/lua_api/l_util.h
+++ b/src/script/lua_api/l_util.h
@@ -38,7 +38,7 @@ private:
// log([level,] text)
// Writes a line to the logger.
// The one-argument version logs to infostream.
- // The two-argument version accept a log level: error, action, info, or verbose.
+ // The two-argument version accepts a log level.
static int l_log(lua_State *L);
// get us precision time