get system information * * Returns a table with system information. * @name sys.get_sys_info * @param [options] [type:table] optional options table * - ignore_secure [type:boolean] this flag ignores values might be secured by OS e.g. `device_ident` * @return sys_info [type:table] table with system information in the following fields: * * `device_model`
| 789 | * ``` |
| 790 | */ |
| 791 | static int Sys_GetSysInfo(lua_State* L) |
| 792 | { |
| 793 | int top = lua_gettop(L); |
| 794 | |
| 795 | dmSys::SystemInfo info; |
| 796 | dmSys::GetSystemInfo(&info); |
| 797 | |
| 798 | bool ignore_secure_values = false; |
| 799 | |
| 800 | if ( top >= 1) |
| 801 | { |
| 802 | luaL_checktype(L, 1, LUA_TTABLE); |
| 803 | lua_pushvalue(L, 1); |
| 804 | |
| 805 | lua_getfield(L, -1, "ignore_secure"); |
| 806 | ignore_secure_values = lua_isnil(L, -1) ? false : lua_toboolean(L, -1); |
| 807 | lua_pop(L, 1); |
| 808 | |
| 809 | lua_pop(L, 1); |
| 810 | } |
| 811 | |
| 812 | if (!ignore_secure_values) |
| 813 | { |
| 814 | dmSys::GetSecureInfo(&info); |
| 815 | } |
| 816 | |
| 817 | lua_newtable(L); |
| 818 | lua_pushliteral(L, "device_model"); |
| 819 | lua_pushstring(L, info.m_DeviceModel); |
| 820 | lua_rawset(L, -3); |
| 821 | lua_pushliteral(L, "manufacturer"); |
| 822 | lua_pushstring(L, info.m_Manufacturer); |
| 823 | lua_rawset(L, -3); |
| 824 | lua_pushliteral(L, "system_name"); |
| 825 | lua_pushstring(L, info.m_SystemName); |
| 826 | lua_rawset(L, -3); |
| 827 | lua_pushliteral(L, "system_version"); |
| 828 | lua_pushstring(L, info.m_SystemVersion); |
| 829 | lua_rawset(L, -3); |
| 830 | lua_pushliteral(L, "api_version"); |
| 831 | lua_pushstring(L, info.m_ApiVersion); |
| 832 | lua_rawset(L, -3); |
| 833 | lua_pushliteral(L, "language"); |
| 834 | lua_pushstring(L, info.m_Language); |
| 835 | lua_rawset(L, -3); |
| 836 | lua_pushliteral(L, "device_language"); |
| 837 | lua_pushstring(L, info.m_DeviceLanguage); |
| 838 | lua_rawset(L, -3); |
| 839 | lua_pushliteral(L, "territory"); |
| 840 | lua_pushstring(L, info.m_Territory); |
| 841 | lua_rawset(L, -3); |
| 842 | lua_pushliteral(L, "gmt_offset"); |
| 843 | lua_pushinteger(L, info.m_GmtOffset); |
| 844 | lua_rawset(L, -3); |
| 845 | lua_pushliteral(L, "device_ident"); |
| 846 | lua_pushstring(L, info.m_DeviceIdentifier); |
| 847 | lua_rawset(L, -3); |
| 848 | lua_pushliteral(L, "user_agent"); |
nothing calls this directly
no test coverage detected