From ba2f0b8c6ba7fb3a26fa6d9676ee1aefe6d873cc Mon Sep 17 00:00:00 2001
From: Diego Nehab
+To obtain the socket namespace, run: +
+ +
+-- loads the socket module
+local socket = require("socket")
+
+
+
@@ -62,8 +72,9 @@ Converts a function that throws exceptions into a safe function.
-Funct is a function that calls -try to throw exceptions. +Func is a function that calls +try (or assert, or error) +to throw exceptions.
@@ -71,6 +82,13 @@ Returns an equivalent function that instead of throwing exceptions, returns nil followed by an error message.
++Note: Beware that if your function performs some illegal operation that +raises an error, the protected function will catch the error and return it +as a string. This is because the try function +uses errors as the mechanism to throw exceptions. +
+@@ -88,8 +106,8 @@ see if it is OK to immediately write on them. Timeout is the maximum amount of time (in seconds) to wait for a change in status. A nil, negative or omitted timeout value allows the function to block indefinitely. Recvt and sendt can also -be empty tables or nil. Non-socket values in the arrays -will be silently ignored. +be empty tables or nil. Non-socket values (or values with +non-numeric indices) in the arrays will be silently ignored.
The function returns a table with the sockets ready for @@ -186,7 +204,7 @@ The function returns a source with the appropriate behavior.
-socket.try(ret1, ret2 ... retN) +socket.try(ret1 [, ret2 ... retN])
@@ -194,16 +212,14 @@ Throws an exception in case of error.
-Ret1, ret2 ... retN can be arbitrary -arguments, but are usually the return values of a function call that -nested with the call to try. +Ret1 to retN can be arbitrary +arguments, but are usually the return values of a function call +nested with try.
-The function returns ret1, ret2 ... -retN if -ret1 is not nil. Otherwise, calls error -passing ret2. +The function returns ret1 to retN if +ret1 is not nil. Otherwise, it calls error passing ret2.
@@ -211,7 +227,7 @@ passing ret2.
c = socket.try(socket.connect("localhost", 80))
-
+
socket.VERSION -- cgit v1.2.3-55-g6feb