diff options
| author | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-11 11:36:15 +0200 |
|---|---|---|
| committer | Benoit Germain <benoit.germain@ubisoft.com> | 2024-06-11 11:36:15 +0200 |
| commit | 84294d0b5462d0a05fb5d53df5a64f7ee624a726 (patch) | |
| tree | 16b79e505db565c5712b442cdfb3f3bb15be7884 /docs | |
| parent | 17f98b33ed26338094a08d25e9fbf25b71c58f16 (diff) | |
| download | lanes-84294d0b5462d0a05fb5d53df5a64f7ee624a726.tar.gz lanes-84294d0b5462d0a05fb5d53df5a64f7ee624a726.tar.bz2 lanes-84294d0b5462d0a05fb5d53df5a64f7ee624a726.zip | |
Fixes and improvements to lane:join()
* fix: returns nil,cancel_error when lane was cancelled
* improvement: enforce non-nil first return value of lane body when using lane:join() to obtain the results
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/index.html | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/docs/index.html b/docs/index.html index 4e8cc25..400ceb1 100644 --- a/docs/index.html +++ b/docs/index.html | |||
| @@ -991,25 +991,23 @@ | |||
| 991 | </pre></td></tr></table> | 991 | </pre></td></tr></table> |
| 992 | 992 | ||
| 993 | <p> | 993 | <p> |
| 994 | <tt>timeout</tt> is an optional number >= 0 (the default if unspecified). | 994 | <tt>timeout</tt> is an optional number >= 0 (the default if unspecified).<br/> |
| 995 | <br/> | 995 | Waits until the lane finishes, or <tt>timeout</tt> seconds have passed.<br/> |
| 996 | Waits until the lane finishes, or <tt>timeout</tt> seconds have passed. | 996 | Unlike in reading the results in table fashion, errors are not propagated.<br/> |
| 997 | <br/> | 997 | Possible return values are: |
| 998 | Returns <tt>nil, "timeout"</tt> on timeout, <tt>nil,err,stack_tbl</tt> if the lane hit an error, <tt>nil, "killed"</tt> if forcefully killed, or the return values of the lane. | 998 | <ul> |
| 999 | <br/> | 999 | <li><tt>nil, "timeout"</tt> on timeout.</li> |
| 1000 | Unlike in reading the results in table fashion, errors are not propagated. | 1000 | <li> |
| 1001 | </p> | 1001 | <tt>nil,err,stack_tbl</tt> if the lane hit an error. The contents of <tt>stack_tbl</tt> change with <a href="#.error_trace_level"><tt>error_trace_level</tt></a>.<br/> |
| 1002 | 1002 | <ul> | |
| 1003 | <p> | 1003 | <li><tt>"minimal"</tt>: <tt>stack_tbl</tt> is <tt>nil</tt>.</li> |
| 1004 | <tt>stack_tbl</tt> is a table describing where the error was thrown. | 1004 | <li><tt>"basic"</tt>: <tt>stack_tbl</tt> is an array of <tt>"<filename>:<line>"</tt> strings. You can use <tt>table.concat()</tt> to format it to your liking (or just ignore it).</li> |
| 1005 | <br/> | 1005 | <li><tt>"extended"</tt>: <tt>stack_tbl</tt> is an array of tables containing info gathered with <tt>lua_getinfo()</tt> (<tt>"source"</tt>,<tt>"currentline"</tt>,<tt>"name"</tt>,<tt>"namewhat"</tt>,<tt>"what"</tt>).</li> |
| 1006 | In <tt>"extended"</tt> mode, <tt>stack_tbl</tt> is an array of tables containing info gathered with <tt>lua_getinfo()</tt> (<tt>"source"</tt>,<tt>"currentline"</tt>,<tt>"name"</tt>,<tt>"namewhat"</tt>,<tt>"what"</tt>). | 1006 | </ul> |
| 1007 | <br/> | 1007 | </li> |
| 1008 | In <tt>"basic"</tt> mode, <tt>stack_tbl</tt> is an array of <tt>"<filename>:<line>"</tt> strings. Use <tt>table.concat()</tt> to format it to your liking (or just ignore it). | 1008 | <li><tt>nil, "killed"</tt> if forcefully killed.</li> |
| 1009 | </p> | 1009 | <li>The return values of the lane function. If the first return value is <tt>nil</tt> (or there is no return value), an error is raised, to make sure you can tell timeout and error cases apart from successful return.</li> |
| 1010 | 1010 | </ul> | |
| 1011 | <p> | ||
| 1012 | If you use <tt>:join()</tt>, make sure your lane main function returns a non-nil value so you can tell timeout and error cases apart from succesful return (using the <tt>.status</tt> property may be risky, since it might change between a timed out join and the moment you read it). | ||
| 1013 | </p> | 1011 | </p> |
| 1014 | 1012 | ||
| 1015 | <table border=1 bgcolor="#FFFFE0" cellpadding="10" style="width:50%"><tr><td><pre> | 1013 | <table border=1 bgcolor="#FFFFE0" cellpadding="10" style="width:50%"><tr><td><pre> |
