equal
deleted
inserted
replaced
1 |
1 |
2 /* Copyright 2009 Myhailo Danylenko |
2 /* Copyright 2009-2016 Myhailo Danylenko |
3 |
3 |
4 This file is part of lua-lm. |
4 This file is part of lua-lm. |
5 |
5 |
6 lua-lm is free software: you can redistribute it and/or modify |
6 lua-lm is free software: you can redistribute it and/or modify |
7 it under the terms of the GNU General Public License as published by |
7 it under the terms of the GNU General Public License as published by |
224 if (lua_gettop (L) > 2) { // Set |
224 if (lua_gettop (L) > 2) { // Set |
225 lm_message_node_set_attribute (node, name, luaL_checkstring (L, 3)); |
225 lm_message_node_set_attribute (node, name, luaL_checkstring (L, 3)); |
226 lua_pop (L, 2); |
226 lua_pop (L, 2); |
227 } else // Get |
227 } else // Get |
228 lua_pushstring (L, lm_message_node_get_attribute (node, name)); |
228 lua_pushstring (L, lm_message_node_get_attribute (node, name)); |
|
229 return 1; |
|
230 } |
|
231 |
|
232 /// message_node:attributes |
|
233 /// Returns a table with message node attributes. |
|
234 /// R: table |
|
235 int attributes_lm_node (lua_State *L) |
|
236 { |
|
237 lua_newtable (L); |
|
238 #ifdef HAVE_LM_MESSAGE_NODE_ATTRIBUTE |
|
239 LmMessageNode *node = luaL_checkLmMessageNode (L, 1); |
|
240 LmMessageNodeAttribute *attribute; |
|
241 for (attribute = node -> attributes; attribute; attribute = attribute -> next) { |
|
242 lua_pushstring (L, attribute -> value); |
|
243 lua_setfield (L, -2, attribute -> name); |
|
244 } |
|
245 #endif |
229 return 1; |
246 return 1; |
230 } |
247 } |
231 |
248 |
232 /// message_node:xml |
249 /// message_node:xml |
233 /// Returns node representation in xml. |
250 /// Returns node representation in xml. |