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)
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.os
as 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