Example #1
0
static int json__newindex(lua_State *L)
{
	JSONNode &node = *((JSON*)luaL_checkudata(L, 1, MT_JSON))->node;
	const char *key = lua_tostring(L, 2);

	JSONNode child = node[key];
	if (child.isnull())
	{
		child.set_name(key);
		node << child;
	}
	lua2json(L, child);
	node[key] = child;

	return 0;
}