author | Myhailo Danylenko <isbear@ukrpost.net> |
Sat, 14 Mar 2009 17:01:53 +0200 | |
changeset 13 | 8f502c1477ac |
parent 12 | 63f06a23c235 |
child 14 | 4cb715fed99b |
permissions | -rw-r--r-- |
0 | 1 |
|
2 |
#include <lua.h> |
|
3 |
#include <lauxlib.h> |
|
4 |
#include <loudmouth/loudmouth.h> |
|
5 |
||
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
6 |
#include "config.h" |
0 | 7 |
#include "lm_types.h" |
8 |
||
9 |
/// lm.message_node |
|
10 |
/// Object, representing xml node of the message. |
|
11 |
/// Cannot be created directly, only as a part of message tree. |
|
12 |
||
13 |
/// lm.message_node.bless |
|
14 |
/// Blesses given pointer to lm message node object. |
|
15 |
/// A: lightuserdata (C lm message node object) |
|
16 |
/// R: lm message node object |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
17 |
static int bless_lua_lm_node (lua_State *L) |
0 | 18 |
{ |
19 |
luaL_argcheck (L, lua_islightuserdata (L, 1), 1, "loudmouth message node lightuserdata expected"); |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
20 |
bless_lm_node (L, lua_touserdata (L, 1)); |
0 | 21 |
return 1; |
22 |
} |
|
23 |
||
24 |
/// message_node:name |
|
25 |
/// Gets a name of message node. |
|
26 |
/// R: string |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
27 |
int name_lm_node (lua_State *L) |
0 | 28 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
29 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
30 |
lua_pushstring (L, node->name); |
0 | 31 |
return 1; |
32 |
} |
|
33 |
||
34 |
/// message_node:next |
|
35 |
/// Gets next message node. |
|
36 |
/// R: lm message node object or nil |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
37 |
int next_lm_node (lua_State *L) |
0 | 38 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
39 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
40 |
LmMessageNode *next = node->next; |
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
41 |
if (next) |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
42 |
bless_lm_node (L, next); |
0 | 43 |
else |
44 |
lua_pushnil (L); |
|
45 |
return 1; |
|
46 |
} |
|
47 |
||
48 |
/// message_node:prev |
|
49 |
/// Gets previous message node. |
|
50 |
/// R: lm message node object or nil |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
51 |
int prev_lm_node (lua_State *L) |
0 | 52 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
53 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
54 |
LmMessageNode *prev = node->prev; |
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
55 |
if (prev) |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
56 |
bless_lm_node (L, prev); |
0 | 57 |
else |
58 |
lua_pushnil (L); |
|
59 |
return 1; |
|
60 |
} |
|
61 |
||
62 |
/// message_node:children |
|
63 |
/// Gets first child node (raw access used). |
|
64 |
/// R: lm message node object or nil |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
65 |
int children_lm_node (lua_State *L) |
0 | 66 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
67 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
68 |
LmMessageNode *child = node->children; |
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
69 |
if (child) |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
70 |
bless_lm_node (L, child); |
0 | 71 |
else |
72 |
lua_pushnil (L); |
|
73 |
return 1; |
|
74 |
} |
|
75 |
||
76 |
/// message_node:parent |
|
77 |
/// Gets parent message node. |
|
78 |
/// R: lm message node object or nil |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
79 |
int parent_lm_node (lua_State *L) |
0 | 80 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
81 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
82 |
LmMessageNode *parent = node->parent; |
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
83 |
if (parent) |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
84 |
bless_lm_node (L, parent); |
0 | 85 |
else |
86 |
lua_pushnil (L); |
|
87 |
return 1; |
|
88 |
} |
|
89 |
||
90 |
/// message_node:value |
|
91 |
/// Gets or sets a value of message node. |
|
92 |
/// A: string (optional value) |
|
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
93 |
/// R: string (if called without arguments) or lm message node object |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
94 |
int value_lm_node (lua_State *L) |
0 | 95 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
96 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
0 | 97 |
if (lua_gettop (L) > 1) { // Set |
98 |
const char *value = luaL_checkstring (L, 2); |
|
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
99 |
lm_message_node_set_value (node, value); |
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
100 |
lua_pop (L, 1); |
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
101 |
} else // Get |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
102 |
lua_pushstring (L, lm_message_node_get_value (node)); |
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
103 |
return 1; |
0 | 104 |
} |
105 |
||
106 |
/// message_node:child |
|
107 |
/// Gets or creates child node object with given name. |
|
108 |
/// A: string (name), string (optional value) |
|
109 |
/// R: lm message node object or nil |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
110 |
int child_lm_node (lua_State *L) |
0 | 111 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
112 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
0 | 113 |
const char *name = luaL_checkstring (L, 2); |
114 |
LmMessageNode *child; |
|
115 |
||
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
116 |
if (lua_gettop (L) > 2) // Add |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
117 |
child = lm_message_node_add_child (node, name, |
0 | 118 |
luaL_checkstring (L, 3)); |
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
119 |
else { // Get |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
120 |
child = lm_message_node_get_child (node, name); |
0 | 121 |
if (!child) { |
122 |
lua_pushnil (L); |
|
123 |
return 1; |
|
124 |
} |
|
125 |
} |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
126 |
bless_lm_node (L, child); |
0 | 127 |
// XXX lm_message_node_unref (child); |
128 |
return 1; |
|
129 |
} |
|
130 |
||
131 |
/// message_node:find_child |
|
132 |
/// Searches for node with a given name over all node subtree. |
|
133 |
/// A: string (name) |
|
134 |
/// R: lm message node object or nil |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
135 |
int find_child_lm_node (lua_State *L) |
0 | 136 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
137 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
0 | 138 |
const char *name = luaL_checkstring (L, 2); |
139 |
LmMessageNode *child; |
|
140 |
||
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
141 |
child = lm_message_node_get_child (node, name); |
0 | 142 |
if (!child) |
143 |
lua_pushnil (L); |
|
144 |
else { |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
145 |
bless_lm_node (L, child); |
0 | 146 |
// XXX lm_message_node_unref (child); |
147 |
} |
|
148 |
return 1; |
|
149 |
} |
|
150 |
||
151 |
/// message_node:raw |
|
152 |
/// Gets or sets raw mode flag for node. |
|
153 |
/// When set, value of node will not be escaped. |
|
154 |
/// A: boolean (optional) |
|
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
155 |
/// V: boolean (if called with no apguments) or lm message node object |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
156 |
int raw_lm_node (lua_State *L) |
0 | 157 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
158 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
0 | 159 |
if (lua_gettop (L) > 1) { // Set |
160 |
luaL_checktype (L, 2, LUA_TBOOLEAN); |
|
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
161 |
lm_message_node_set_raw_mode (node, lua_toboolean (L, 2)); |
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
162 |
lua_pop (L, 1); |
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
163 |
} else // Get |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
164 |
lua_pushboolean (L, lm_message_node_get_raw_mode (node)); |
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
165 |
return 1; |
0 | 166 |
} |
167 |
||
168 |
/// message_node:attribute |
|
169 |
/// Gets or sets value of node attribute with a given name. |
|
170 |
/// A: string (name), string (optional value) |
|
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
171 |
/// R: string (when called with one aprgument) or lm message node object |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
172 |
int attribute_lm_node (lua_State *L) |
0 | 173 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
174 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
0 | 175 |
const char *name = luaL_checkstring (L, 2); |
176 |
if (lua_gettop (L) > 2) { // Set |
|
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
177 |
lm_message_node_set_attribute (node, name, luaL_checkstring (L, 3)); |
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
178 |
lua_pop (L, 2); |
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
179 |
} else // Get |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
180 |
lua_pushstring (L, lm_message_node_get_attribute (node, name)); |
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
181 |
return 1; |
0 | 182 |
} |
183 |
||
184 |
/// message_node:xml |
|
185 |
/// Returns node representation in xml. |
|
186 |
/// R: string |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
187 |
int xml_lm_node (lua_State *L) |
0 | 188 |
{ |
7
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
189 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
5db1448eb857
Message have node methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
6
diff
changeset
|
190 |
lua_pushstring (L, lm_message_node_to_string (node)); |
0 | 191 |
return 1; |
192 |
} |
|
193 |
||
8 | 194 |
/// message_node:path |
195 |
/// Returns node with specified path to it. |
|
196 |
/// If any element in a path cannot be found, it returns nil. |
|
197 |
/// A: string (node name), ... |
|
198 |
/// R: lm message node object or nil |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
199 |
int path_lm_node (lua_State *L) |
8 | 200 |
{ |
201 |
LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
|
202 |
int i = 1; |
|
203 |
while (i++ < lua_gettop (L)) { |
|
204 |
node = lm_message_node_get_child (node, luaL_checkstring (L, i)); |
|
205 |
if (node == NULL) { |
|
206 |
lua_pushnil (L); |
|
207 |
return 1; |
|
208 |
} |
|
209 |
} |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
210 |
bless_lm_node (L, node); |
8 | 211 |
// XXX lm_message_node_unref (child); |
212 |
return 1; |
|
213 |
} |
|
214 |
||
0 | 215 |
/// message_node:pointer |
216 |
/// Returns pointer to underlying C structure. |
|
217 |
/// R: lightuserdata |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
218 |
static int pointer_lm_node (lua_State *L) |
0 | 219 |
{ |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
220 |
llm_node_t *object = luaL_checklm_node (L, 1); |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
221 |
lua_pushlightuserdata (L, object->node); |
0 | 222 |
return 1; |
223 |
} |
|
224 |
||
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
225 |
static int gc_lm_node (lua_State *L) |
0 | 226 |
{ |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
227 |
llm_node_t *object = luaL_checklm_node (L, 1); |
6
90073cbb535d
Logging and chained methods
Myhailo Danylenko <isbear@ukrpost.net>
parents:
0
diff
changeset
|
228 |
D ("Message node %X gc called", (int) object); |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
229 |
lm_message_node_unref (object->node); |
0 | 230 |
return 0; |
231 |
} |
|
232 |
||
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
233 |
static const luaL_Reg reg_f_lm_node[] = { |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
234 |
{ "bless", bless_lua_lm_node }, |
12 | 235 |
{ NULL, NULL }, |
0 | 236 |
}; |
237 |
||
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
238 |
static const luaL_Reg reg_m_lm_node[] = { |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
239 |
{ "name", name_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
240 |
{ "next", next_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
241 |
{ "prev", prev_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
242 |
{ "children", children_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
243 |
{ "parent", parent_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
244 |
{ "value", value_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
245 |
{ "child", child_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
246 |
{ "find_child", find_child_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
247 |
{ "attribute", attribute_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
248 |
{ "raw", raw_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
249 |
{ "xml", xml_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
250 |
{ "path", path_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
251 |
{ "pointer", pointer_lm_node }, |
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
252 |
{ "__gc", gc_lm_node }, |
12 | 253 |
{ NULL, NULL }, |
0 | 254 |
}; |
255 |
||
256 |
int luaopen_lm_message_node (lua_State *L) |
|
257 |
{ |
|
258 |
luaL_newmetatable (L, "loudmouth.message_node"); |
|
259 |
lua_pushstring (L, "__index"); |
|
260 |
lua_pushvalue (L, -2); |
|
261 |
lua_settable (L, -3); |
|
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
262 |
luaL_register (L, NULL, reg_m_lm_node); |
0 | 263 |
lua_pop (L, 1); |
11
a8c6460d612b
Naming scheme change to more ld-friendly
Myhailo Danylenko <isbear@ukrpost.net>
parents:
8
diff
changeset
|
264 |
luaL_register (L, "lm.message_node", reg_f_lm_node); |
0 | 265 |
return 1; |
266 |
} |
|
267 |