diff --git a/library/LuaTypes.cpp b/library/LuaTypes.cpp index 0904ff8f9..fa9445a81 100644 --- a/library/LuaTypes.cpp +++ b/library/LuaTypes.cpp @@ -49,6 +49,16 @@ distribution. using namespace DFHack; using namespace DFHack::LuaWrapper; +#ifdef _DARWIN +#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_6 +size_t strnlen (const char *str, size_t max) +{ + const char *end = (const char*)memchr(str, 0, max); + return end ? (size_t)(end - str) : max; +} +#endif +#endif + /************************************** * Identity object read/write methods * **************************************/