util/xmlrpc: Added <nil/> extension to RPC functions (allowing nil parameters and return values)

Sun, 08 Mar 2009 01:06:37 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Sun, 08 Mar 2009 01:06:37 +0500
changeset 888
1059230969c3
parent 881
c508fb40552a
child 889
bb959588bbc4

util/xmlrpc: Added <nil/> extension to RPC functions (allowing nil parameters and return values)

util/xmlrpc.lua file | annotate | diff | comparison | revisions
--- a/util/xmlrpc.lua	Wed Mar 04 18:48:29 2009 +0000
+++ b/util/xmlrpc.lua	Sun Mar 08 01:06:37 2009 +0500
@@ -41,6 +41,9 @@
 	number=function(stanza, object)
 		stanza:tag("int"):text(tostring(object)):up();
 	end;
+	["nil"]=function(stanza, object) -- nil extension
+		stanza:tag("nil"):up();
+	end;
 };
 _lua_to_xmlrpc = function(stanza, object)
 	local h = map[type(object)];
@@ -146,6 +149,9 @@
 		if tostring(tonumber(n)) == n then n = tonumber(n); end
 		return n;
 	end;
+	["nil"]=function(stanza) -- nil extension
+		return nil;
+	end;
 }
 _xmlrpc_to_lua = function(stanza)
 	local h = rmap[stanza.name];

mercurial