summaryrefslogtreecommitdiff
path: root/plugins/MirLua/src/stdafx.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MirLua/src/stdafx.h')
-rw-r--r--plugins/MirLua/src/stdafx.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/MirLua/src/stdafx.h b/plugins/MirLua/src/stdafx.h
index efefd020ad..90e60660d8 100644
--- a/plugins/MirLua/src/stdafx.h
+++ b/plugins/MirLua/src/stdafx.h
@@ -47,6 +47,14 @@ struct luaM_const
intptr_t value;
};
+template<typename T>
+T *mir_memdup(T* ptr, size_t size = sizeof(T), bool bCalloc = false)
+{
+ void *newptr = (bCalloc ? mir_calloc : mir_alloc)(size);
+ memcpy(newptr, ptr, size);
+ return (T*)newptr;
+}
+
#include "mlua.h"
#include "mlua_script.h"
#include "mlua_module_loader.h"