aboutsummaryrefslogtreecommitdiff
path: root/ltn013.wiki
diff options
context:
space:
mode:
Diffstat (limited to 'ltn013.wiki')
-rw-r--r--ltn013.wiki6
1 files changed, 3 insertions, 3 deletions
diff --git a/ltn013.wiki b/ltn013.wiki
index 734b433..a622424 100644
--- a/ltn013.wiki
+++ b/ltn013.wiki
@@ -73,12 +73,12 @@ Fortunately, all these problems are very easy to solve and that's what we do in
73We used the {{pcall}} function to shield the user from errors that could be raised by the underlying implementation. Instead of directly using {{pcall}} (and thus duplicating code) every time we prefer a factory that does the same job: 73We used the {{pcall}} function to shield the user from errors that could be raised by the underlying implementation. Instead of directly using {{pcall}} (and thus duplicating code) every time we prefer a factory that does the same job:
74 {{{ 74 {{{
75local function pack(ok, ...) 75local function pack(ok, ...)
76 return ok, arg 76 return ok, {...}
77end 77end
78 78
79function protect(f) 79function protect(f)
80 return function(...) 80 return function(...)
81 local ok, ret = pack(pcall(f, unpack(arg))) 81 local ok, ret = pack(pcall(f, ...))
82 if ok then return unpack(ret) 82 if ok then return unpack(ret)
83 else return nil, ret[1] end 83 else return nil, ret[1] end
84 end 84 end
@@ -157,7 +157,7 @@ function newtry(f)
157 if f then f() end 157 if f then f() end
158 error(arg[2], 0) 158 error(arg[2], 0)
159 else 159 else
160 return unpack(arg) 160 return ...
161 end 161 end
162 end 162 end
163end 163end