blob: 298f91d5c265b8db36acabca591cd643161d4f2f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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"
|