diff options
Diffstat (limited to 'ltn013.wiki')
-rw-r--r-- | ltn013.wiki | 6 |
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 | |||
73 | We 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: | 73 | We 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 | {{{ |
75 | local function pack(ok, ...) | 75 | local function pack(ok, ...) |
76 | return ok, arg | 76 | return ok, {...} |
77 | end | 77 | end |
78 | 78 | ||
79 | function protect(f) | 79 | function 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 |
163 | end | 163 | end |