aboutsummaryrefslogtreecommitdiff
path: root/src/util/string.cpp
diff options
context:
space:
mode:
authorkwolekr <kwolekr@minetest.net>2014-02-09 12:38:50 -0500
committerkwolekr <kwolekr@minetest.net>2014-02-09 12:44:31 -0500
commit2a01050a0cf0826f25240e2cb407535394ee360f (patch)
treebb6d3fd3b27be094db7e885adc5ac25dc5e45139 /src/util/string.cpp
parent57710520dca6bce175a6be48989e0a4689b1404e (diff)
downloadminetest-2a01050a0cf0826f25240e2cb407535394ee360f.tar.gz
minetest-2a01050a0cf0826f25240e2cb407535394ee360f.tar.bz2
minetest-2a01050a0cf0826f25240e2cb407535394ee360f.zip
Add capability to read table flag fields from Lua API
Diffstat (limited to 'src/util/string.cpp')
-rw-r--r--src/util/string.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/util/string.cpp b/src/util/string.cpp
index afe40610c..a3888c9ce 100644
--- a/src/util/string.cpp
+++ b/src/util/string.cpp
@@ -163,6 +163,19 @@ std::string writeFlagString(u32 flags, FlagDesc *flagdesc, u32 flagmask)
return result;
}
+size_t mystrlcpy(char *dst, const char *src, size_t size)
+{
+ size_t srclen = strlen(src) + 1;
+ size_t copylen = MYMIN(srclen, size);
+
+ if (copylen > 0) {
+ memcpy(dst, src, copylen);
+ dst[copylen - 1] = '\0';
+ }
+
+ return srclen;
+}
+
char *mystrtok_r(char *s, const char *sep, char **lasts)
{
char *t;