diff --git a/autogen/convert_functions.py b/autogen/convert_functions.py
index 1f0bf46fa..90f2fafaa 100644
--- a/autogen/convert_functions.py
+++ b/autogen/convert_functions.py
@@ -223,6 +223,7 @@ manual_index_documentation = """
- [smlua_anim_util_register_animation](#smlua_anim_util_register_animation)
- [level_script_parse](#level_script_parse)
- [log_to_console](#log_to_console)
+ - [log_to_stdout](#log_to_stdout)
- [add_scroll_target](#add_scroll_target)
- [collision_find_surface_on_ray](#collision_find_surface_on_ray)
- [cast_graph_node](#cast_graph_node)
@@ -494,6 +495,29 @@ Logs a message to the in-game console.
+## [log_to_stdout](#log_to_stdout)
+
+Logs a message to standard output.
+
+### Lua Example
+`log_to_stdout("sm64coopdx FTW", CONSOLE_MESSAGE_INFO)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| message | `string` |
+| level (optional) | `ConsoleMessageLevel` |
+
+### Returns
+- None
+
+### C Prototype
+`void log_to_stdout(const char* message, enum ConsoleMessageLevel level);`
+
+[:arrow_up_small:](#)
+
+
+
## [add_scroll_target](#add_scroll_target)
Registers a vertex buffer to be used for a scrolling texture. Should be used with `RM_Scroll_Texture` or `editor_Scroll_Texture`
diff --git a/autogen/lua_definitions/manual.lua b/autogen/lua_definitions/manual.lua
index 1e9cbe212..40afe22cd 100644
--- a/autogen/lua_definitions/manual.lua
+++ b/autogen/lua_definitions/manual.lua
@@ -405,6 +405,13 @@ function log_to_console(message, level)
-- ...
end
+--- @param message string The message to log
+--- @param level? ConsoleMessageLevel Optional; Determines whether the message should appear as info, a warning or an error.
+--- Logs a message to standard output
+function log_to_stdout(message, level)
+ -- ...
+end
+
--- @param index integer The index of the scroll target, should match up with the behavior param of `RM_Scroll_Texture` or `editor_Scroll_Texture`
--- @param name string The name of the vertex buffer that should be used while scrolling the texture
--- Registers a vertex buffer to be used for a scrolling texture. Should be used with `RM_Scroll_Texture` or `editor_Scroll_Texture`
diff --git a/docs/lua/functions.md b/docs/lua/functions.md
index 76fc6a55b..d26d230ac 100644
--- a/docs/lua/functions.md
+++ b/docs/lua/functions.md
@@ -20,6 +20,7 @@
- [smlua_anim_util_register_animation](#smlua_anim_util_register_animation)
- [level_script_parse](#level_script_parse)
- [log_to_console](#log_to_console)
+ - [log_to_stdout](#log_to_stdout)
- [add_scroll_target](#add_scroll_target)
- [collision_find_surface_on_ray](#collision_find_surface_on_ray)
- [cast_graph_node](#cast_graph_node)
@@ -2455,6 +2456,29 @@ Logs a message to the in-game console.
+## [log_to_stdout](#log_to_stdout)
+
+Logs a message to standard output.
+
+### Lua Example
+`log_to_stdout("sm64coopdx FTW", CONSOLE_MESSAGE_INFO)`
+
+### Parameters
+| Field | Type |
+| ----- | ---- |
+| message | `string` |
+| level (optional) | `ConsoleMessageLevel` |
+
+### Returns
+- None
+
+### C Prototype
+`void log_to_stdout(const char* message, enum ConsoleMessageLevel level);`
+
+[:arrow_up_small:](#)
+
+
+
## [add_scroll_target](#add_scroll_target)
Registers a vertex buffer to be used for a scrolling texture. Should be used with `RM_Scroll_Texture` or `editor_Scroll_Texture`
diff --git a/src/pc/lua/smlua_functions.c b/src/pc/lua/smlua_functions.c
index d9c926bf1..bccb85f1b 100644
--- a/src/pc/lua/smlua_functions.c
+++ b/src/pc/lua/smlua_functions.c
@@ -796,6 +796,37 @@ int smlua_func_log_to_console(lua_State* L) {
return 1;
}
+int smlua_func_log_to_stdout(lua_State* L) {
+ if (!smlua_functions_valid_param_range(L, 1, 2)) { return 0; }
+
+ int paramCount = lua_gettop(L);
+
+ const char* message = smlua_to_string(L, 1);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("log_to_stdout: Failed to convert parameter 1 for function"); return 0; }
+
+ enum ConsoleMessageLevel level = CONSOLE_MESSAGE_INFO;
+ if (paramCount >= 2) {
+ level = smlua_to_integer(L, 2);
+ if (!gSmLuaConvertSuccess) { LOG_LUA("log_to_stdout: Failed to convert parameter 2 for function"); return 0; }
+ }
+
+ const char* origin = gLuaActiveModFile->relativePath;
+
+ switch (level) {
+ case CONSOLE_MESSAGE_INFO:
+ LOG_INFO("%s: %s", origin, message);
+ break;
+ case CONSOLE_MESSAGE_WARNING:
+ LOG_WARNING("%s: %s", origin, message);
+ break;
+ case CONSOLE_MESSAGE_ERROR:
+ LOG_ERROR("%s: %s", origin, message);
+ break;
+ }
+
+ return 1;
+}
+
////////////////////
// scroll targets //
////////////////////
@@ -1042,6 +1073,7 @@ void smlua_bind_functions(void) {
smlua_bind_function(L, "level_script_parse", smlua_func_level_script_parse);
smlua_bind_function(L, "smlua_anim_util_register_animation", smlua_func_smlua_anim_util_register_animation);
smlua_bind_function(L, "log_to_console", smlua_func_log_to_console);
+ smlua_bind_function(L, "log_to_stdout", smlua_func_log_to_stdout);
smlua_bind_function(L, "add_scroll_target", smlua_func_add_scroll_target);
smlua_bind_function(L, "collision_find_surface_on_ray", smlua_func_collision_find_surface_on_ray);
smlua_bind_function(L, "cast_graph_node", smlua_func_cast_graph_node);