Description
VERY simple detection for the running device's operating system. Does NOT detect the operating systems of connected clients on a server - as the mod isn't able to access their machines.
Detects operating system via the mod path string (core.get_modpath), but isn't fully reliable. As certain folk can modify how their parent directories work and activate the needed switches in my mod to misidentify. Additionaly, this mod is unable to tell the difference between Linux distros, as well as Linux vs OpenBSD.
Windows, Android, and Linux detection has been tested. However MacOS, iOS, and iPad haven't been tested, nor has the detection for MultiCraft been tested.
This mod should be utilized in singleplayer settings - where a setting should be activated if the player is on a mobile device (Android, iOS, iPad)
Releases
2025-08-16 13:49 UTC
Adds commands, utilizes LuaJIT if available
Adds 2 new functions
os_detector.get_architecture - returns "Unknown" if LuaJIT is not detected
os_detector.is_mobile - returns true or false depending on if the Operating System's name is detected as being that of a mobile device
Renames global to os_detector, keeping OS_detector for backwards compatibility
Provides several new commands prefixed with /osd command
/osd os - prints operating system's name
/osd is_mobile/mobile - tells you whether or not your device is detected as being mobile, mentions operating system name as well
/osd architecture/arch - prints the operating system's detected architecture (if LuaJIT is enabled, returns "Unknown" otherwise)
IF SINGLEPLAYER:
/osd modpath - prints the modpath for the mod
2025-08-09 01:07 UTC
Initial Release
3 tested OS checks, 3 untested OS checks
API provided
All releases
Threads
New thread
Information
Provides
operating_system_detector
Dependencies
- Required
-
No required dependencies
Information
- Type
- Mod
- Technical Name
- operating_system_detector
- Languages
-
English, Français
- License
-
MIT
- Maintenance State
- Beta
- Added
- 2025-08-09 01:02 UTC
- Maintainers
-
TPH
also consider `jit.os`
jit.os- Works only on luajit, but that is what 99.9% of luanti users have (i wish luanti didn't support lua5.1)This is a cool way to detect what operating system the server has too, just not as simple as checking
jit.osas for the API i am kinda confused why you use functions to get stuff, i think i would do:
instead of what you did in https://codeberg.org/TPH/operating_system_detector/src/branch/master/init.lua#L74