diff --git a/autogen/lua_definitions/functions.lua b/autogen/lua_definitions/functions.lua
index 6b5ec6b5..502423d0 100644
--- a/autogen/lua_definitions/functions.lua
+++ b/autogen/lua_definitions/functions.lua
@@ -8350,6 +8350,11 @@ function get_network_area_timer()
-- ...
end
+--- @return string
+function get_os_name()
+ -- ...
+end
+
--- @return integer
function get_skybox()
-- ...
diff --git a/docs/lua/functions-4.md b/docs/lua/functions-4.md
index b4a4f5fa..ac54f492 100644
--- a/docs/lua/functions-4.md
+++ b/docs/lua/functions-4.md
@@ -8353,6 +8353,24 @@
+## [get_os_name](#get_os_name)
+
+### Lua Example
+`local stringValue = get_os_name()`
+
+### Parameters
+- None
+
+### Returns
+- `string`
+
+### C Prototype
+`char* get_os_name(void);`
+
+[:arrow_up_small:](#)
+
+
+
## [get_skybox](#get_skybox)
### Lua Example
diff --git a/docs/lua/functions.md b/docs/lua/functions.md
index bbd7050d..2094608b 100644
--- a/docs/lua/functions.md
+++ b/docs/lua/functions.md
@@ -1554,6 +1554,7 @@
- [get_last_star_or_key](functions-4.md#get_last_star_or_key)
- [get_lighting_dir](functions-4.md#get_lighting_dir)
- [get_network_area_timer](functions-4.md#get_network_area_timer)
+ - [get_os_name](functions-4.md#get_os_name)
- [get_skybox](functions-4.md#get_skybox)
- [get_temp_s32_pointer](functions-4.md#get_temp_s32_pointer)
- [get_time](functions-4.md#get_time)
diff --git a/src/pc/lua/smlua_functions_autogen.c b/src/pc/lua/smlua_functions_autogen.c
index 52d72794..8b63200c 100644
--- a/src/pc/lua/smlua_functions_autogen.c
+++ b/src/pc/lua/smlua_functions_autogen.c
@@ -27230,6 +27230,21 @@ int smlua_func_get_network_area_timer(UNUSED lua_State* L) {
return 1;
}
+int smlua_func_get_os_name(UNUSED lua_State* L) {
+ if (L == NULL) { return 0; }
+
+ int top = lua_gettop(L);
+ if (top != 0) {
+ LOG_LUA_LINE("Improper param count for '%s': Expected %u, Received %u", "get_os_name", 0, top);
+ return 0;
+ }
+
+
+ lua_pushstring(L, get_os_name());
+
+ return 1;
+}
+
int smlua_func_get_skybox(UNUSED lua_State* L) {
if (L == NULL) { return 0; }
@@ -30616,6 +30631,7 @@ void smlua_bind_functions_autogen(void) {
smlua_bind_function(L, "get_last_star_or_key", smlua_func_get_last_star_or_key);
smlua_bind_function(L, "get_lighting_dir", smlua_func_get_lighting_dir);
smlua_bind_function(L, "get_network_area_timer", smlua_func_get_network_area_timer);
+ smlua_bind_function(L, "get_os_name", smlua_func_get_os_name);
smlua_bind_function(L, "get_skybox", smlua_func_get_skybox);
smlua_bind_function(L, "get_temp_s32_pointer", smlua_func_get_temp_s32_pointer);
smlua_bind_function(L, "get_time", smlua_func_get_time);
diff --git a/src/pc/lua/utils/smlua_misc_utils.c b/src/pc/lua/utils/smlua_misc_utils.c
index 359828d0..e112502a 100644
--- a/src/pc/lua/utils/smlua_misc_utils.c
+++ b/src/pc/lua/utils/smlua_misc_utils.c
@@ -438,3 +438,19 @@ u16 get_envfx(void) {
void set_override_envfx(s32 envfx) {
gOverrideEnvFx = envfx;
}
+
+char* get_os_name(void) {
+#if defined(_WIN32) || defined(_WIN64)
+ return "Windows";
+#elif __APPLE__ || __MACH__
+ return "Mac OSX";
+#elif __linux__
+ return "Linux";
+#elif __FreeBSD__
+ return "FreeBSD";
+#elif __unix || __unix__
+ return "Unix";
+#else
+ return "Unknown";
+#endif
+}
diff --git a/src/pc/lua/utils/smlua_misc_utils.h b/src/pc/lua/utils/smlua_misc_utils.h
index 3d16d754..467d177d 100644
--- a/src/pc/lua/utils/smlua_misc_utils.h
+++ b/src/pc/lua/utils/smlua_misc_utils.h
@@ -110,4 +110,6 @@ u32 get_time(void);
u16 get_envfx(void);
void set_override_envfx(s32 envfx);
+char* get_os_name(void);
+
#endif