lm.lua
changeset 6 90073cbb535d
parent 0 84fdfb0344c9
child 7 5db1448eb857
--- a/lm.lua	Mon Feb 16 01:32:12 2009 +0200
+++ b/lm.lua	Fri Feb 20 23:07:43 2009 +0200
@@ -1,11 +1,11 @@
 
-require ( 'loudmouth' )
+lm = require 'loudmouth'
 
 -- argument is a table with keys,
 -- corresponding to method names.
 function lm.proxy.create ( a )
 	if type ( a ) ~= "table" then
-		error ( "arguments should be in a table" )
+		error "arguments should be in a table"
 	end
 	local p = lm.proxy.new ()
 	if a.server then
@@ -31,7 +31,7 @@
 function lm.ssl.create ( a )
 	if not lm.ssl.supported () then
 		-- XXX
-		-- error ( "ssl is not supported by your loudmouth library" )
+		-- error "ssl is not supported by your loudmouth library"
 		return nil
 	end
 	local fp, cb
@@ -44,7 +44,7 @@
 	elseif st == "string" then
 		fp = a
 	elseif st ~= "nil" then
-		error ( "unexpected type of argument" )
+		error "unexpected type of argument"
 	end
 	if fp then
 		if cb then
@@ -80,7 +80,7 @@
 	elseif at == "table" then
 		local server = a.server
 		if not server then
-			error ( "server name parameter required" )
+			error "server name parameter required"
 		end
 
 		-- create connection object
@@ -208,10 +208,10 @@
 --]]
 function lm.message.create ( a )
 	if type ( a ) ~= "table" then
-		error ( "table expected as argument" )
+		error "table expected as argument"
 	end
 	if not a.mtype or not a.to then
-		error ( "you must specify message type and destination" )
+		error "you must specify message type and destination"
 	end
 	local mtype, subtype = a.mtype:match ( "(.-)%-(.+)" )
 	local m
@@ -267,7 +267,7 @@
 -- resource
 function lm.connect ( a )
 	if type ( a ) ~= "table" then
-		error ( "table expected as argument" )
+		error "table expected as argument"
 	end
 	if a.ssl then
 		if a.ssl.validate and not a.ssl.callback then