aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-08-05 20:18:24 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-08-05 20:18:24 +0000
commit367d912500ba30932c001127cc135448ad037c52 (patch)
treedba8521adf69bf30f03fd24c5c211cf6f6732498
parentbfcf0d576cae312afbf26cad4232b806a1723a33 (diff)
downloadluasocket-367d912500ba30932c001127cc135448ad037c52.tar.gz
luasocket-367d912500ba30932c001127cc135448ad037c52.tar.bz2
luasocket-367d912500ba30932c001127cc135448ad037c52.zip
Typos.
-rw-r--r--ltn013.wiki4
1 files changed, 2 insertions, 2 deletions
diff --git a/ltn013.wiki b/ltn013.wiki
index a5a75cb..734b433 100644
--- a/ltn013.wiki
+++ b/ltn013.wiki
@@ -15,7 +15,7 @@ Most Lua functions return {{nil}} in case of error, followed by a message descri
15 15
16If you are like me, you hate error checking. Most nice little code snippets that look beautiful when you first write them lose some of their charm when you add all that error checking code. Yet, error checking is as important as the rest of the code. How sad. 16If you are like me, you hate error checking. Most nice little code snippets that look beautiful when you first write them lose some of their charm when you add all that error checking code. Yet, error checking is as important as the rest of the code. How sad.
17 17
18Even if you stick to a return convention, any complex task which involves several function calls makes error checking both boring and error-prone (do you see the error below?) 18Even if you stick to a return convention, any complex task involving several function calls makes error checking both boring and error-prone (do you see the ''error'' below?)
19 {{{ 19 {{{
20function task(arg1, arg2, ...) 20function task(arg1, arg2, ...)
21 local ret1, err = task1(arg1) 21 local ret1, err = task1(arg1)
@@ -32,7 +32,7 @@ function task(arg1, arg2, ...)
32end 32end
33}}} 33}}}
34 34
35The standard {{assert}} function provides an interesting alternative. To use it, the user nests every function calls with calls to {{assert}}. {{Assert}} checks the value of its first argument, and raises an error (it's second argument) if it is {{nil}}. Otherwise, {{assert}} lets all arguments through as if had not been there. The idea greatly simplifies error checking: 35The standard {{assert}} function provides an interesting alternative. To use it, simply nest every function call to be error checked with a call to {{assert}}. The {{assert}} function checks the value of its first argument. If it is {{nil}}, {{assert}} throws the second argument as an error message. Otherwise, {{assert}} lets all arguments through as if had not been there. The idea greatly simplifies error checking:
36 {{{ 36 {{{
37function task(arg1, arg2, ...) 37function task(arg1, arg2, ...)
38 local ret1 = assert(task1(arg1)) 38 local ret1 = assert(task1(arg1))