summaryrefslogtreecommitdiff
path: root/plugins/MirLua/Modules/m_json/src/stdafx.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/MirLua/Modules/m_json/src/stdafx.h')
-rw-r--r--plugins/MirLua/Modules/m_json/src/stdafx.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/plugins/MirLua/Modules/m_json/src/stdafx.h b/plugins/MirLua/Modules/m_json/src/stdafx.h
new file mode 100644
index 0000000000..d8ecdcacb5
--- /dev/null
+++ b/plugins/MirLua/Modules/m_json/src/stdafx.h
@@ -0,0 +1,37 @@
+#pragma once
+
+#include <Windows.h>
+#include <lua.hpp>
+#include <m_system_cpp.h>
+//#include "..\..\..\src\mlua_metatable.h"
+
+#include <m_core.h>
+#include <m_json.h>
+#include <m_string.h>
+
+struct JSON
+{
+ JSONNode *node;
+ bool bDelete;
+
+ JSON(JSONNode &refNode, bool bCopy = false)
+ : node(bCopy ? json_copy(&refNode) : &refNode), bDelete(bCopy) { }
+ JSON(JSONNode *n, bool bD = true)
+ : node(n), bDelete(bD) { }
+ ~JSON()
+ {
+ if (bDelete)
+ json_delete(node);
+ }
+
+ __inline void* operator new(size_t size, lua_State *L)
+ {
+ return lua_newuserdata(L, size);
+ }
+};
+
+void lua2json(lua_State *L, JSONNode &node);
+
+extern const luaL_Reg jsonApi[];
+
+#define MT_JSON "JSON" \ No newline at end of file