From 334817fa1be79a9f529433ade677a39e08b34c30 Mon Sep 17 00:00:00 2001 From: lethosor Date: Thu, 2 Mar 2017 14:04:34 -0500 Subject: [PATCH] Add Lua API functions to determine architecture --- library/LuaApi.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp index 39404e9be..a2446c78a 100644 --- a/library/LuaApi.cpp +++ b/library/LuaApi.cpp @@ -1386,6 +1386,16 @@ static std::string getOSType() } } +static int getArchitecture() +{ + return sizeof(void*) * 8; +} + +static std::string getArchitectureName() +{ + return getArchitecture() == 64 ? "x86_64" : "x86"; +} + static std::string getDFVersion() { return Core::getInstance().vinfo->getVersion(); } static uint32_t getTickCount() { return Core::getInstance().p->getTickCount(); } @@ -1403,6 +1413,8 @@ static std::string df2console(std::string s) { return DF2CONSOLE(s); } static const LuaWrapper::FunctionReg dfhack_module[] = { WRAP(getOSType), + WRAP(getArchitecture), + WRAP(getArchitectureName), WRAP(getDFVersion), WRAP(getDFPath), WRAP(getTickCount),