diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/index.html | 52 |
1 files changed, 14 insertions, 38 deletions
diff --git a/docs/index.html b/docs/index.html index 5675f65..4e8cc25 100644 --- a/docs/index.html +++ b/docs/index.html | |||
@@ -368,19 +368,6 @@ | |||
368 | </tr> | 368 | </tr> |
369 | 369 | ||
370 | <tr valign=top> | 370 | <tr valign=top> |
371 | <td id="demote_full_userdata"> | ||
372 | <code>.demote_full_userdata</code> | ||
373 | </td> | ||
374 | <td> | ||
375 | <tt>nil</tt>/<tt>false</tt>/<tt>true</tt> | ||
376 | </td> | ||
377 | <td> | ||
378 | If equal to <tt>false</tt> or <tt>nil</tt>, Lanes raises an error when attempting to transfer a non-deep full userdata, else it will be demoted to a light userdata in the destination. | ||
379 | Default is <tt>false</tt> (set to <tt>true</tt> to get the legacy behaviour). | ||
380 | </td> | ||
381 | </tr> | ||
382 | |||
383 | <tr valign=top> | ||
384 | <td id="track_lanes"> | 371 | <td id="track_lanes"> |
385 | <code>.track_lanes</code> | 372 | <code>.track_lanes</code> |
386 | </td> | 373 | </td> |
@@ -1547,47 +1534,36 @@ On the other side, you need to use a common Linda for waiting for multiple keys. | |||
1547 | 1534 | ||
1548 | <p> | 1535 | <p> |
1549 | Data passed between lanes (either as starting parameters, return values, upvalues or via Lindas) must conform to the following: | 1536 | Data passed between lanes (either as starting parameters, return values, upvalues or via Lindas) must conform to the following: |
1550 | </p> | ||
1551 | |||
1552 | <p> | ||
1553 | <ul> | 1537 | <ul> |
1538 | <li>Coroutines cannot be passed. A coroutine's Lua state is tied to the Lua state that created it, and there is no way the mixed C/Lua stack of a coroutine can be transfered from one Lua state to another.</li> | ||
1539 | <li>Lane handles cannot be passed between lanes.</li> | ||
1554 | <li>Booleans, numbers, strings, light userdata, Lua functions and tables of such can always be passed.</li> | 1540 | <li>Booleans, numbers, strings, light userdata, Lua functions and tables of such can always be passed.</li> |
1555 | <li> | 1541 | <li> |
1556 | Cyclic tables and/or duplicate references are allowed and reproduced appropriately, but only <u>within the same transmission</u>. | 1542 | Cyclic tables and/or duplicate references are allowed and reproduced appropriately, but only <u>within the same transmission</u>. |
1557 | <ul> | 1543 | Using the same source table in multiple <a href="#lindas">Linda</a> messages keeps no ties between the tables (this is the same reason why tables can't be used as keys). |
1558 | <li>Using the same source table in multiple <a href="#lindas">Linda</a> messages keeps no ties between the tables (this is the same reason why tables can't be used as keys).</li> | ||
1559 | </ul> | ||
1560 | </li> | 1544 | </li> |
1561 | <li> | 1545 | <li> |
1562 | Objects (tables with a metatable) are copyable between lanes. | 1546 | For tables and full userdata: before anything else, the metatable is searched for a <tt>__lanesconvert</tt> field. If found, the source object is converted as follows depending on <tt>__lanesconvert</tt>'s value: |
1563 | <ul> | 1547 | <ul> |
1564 | <li>Metatables are assumed to be immutable; they are internally indexed and only copied once per each type of objects per lane.</li> | 1548 | <li><tt>lanes.null</tt>: The value is converted to <tt>nil</tt>.</li> |
1549 | <li><tt>"decay"</tt>: The value is converted to a light userdata obtained from <tt>lua_topointer()</tt>.</li> | ||
1550 | <li>A function: The function is called as <tt>o:__lanesconvert(string)</tt>, where the argument is either <tt>"keeper"</tt> or <tt>"regular"</tt>, depending on the type of destination. Its (single) return value is the result of the conversion.</li> | ||
1551 | <li>Any other value raises an error.</li> | ||
1565 | </ul> | 1552 | </ul> |
1566 | </li> | 1553 | </li> |
1567 | <li> | 1554 | <li> |
1568 | C functions (<tt>lua_CFunction</tt>) referring to <tt>LUA_ENVIRONINDEX</tt> or <tt>LUA_REGISTRYINDEX</tt> might not do what you expect in the target, since they will actually use a different environment. | 1555 | Non-converted full userdata can be passed only if it is prepared using the <a href="#deep_userdata">deep userdata</a> system, which handles its lifespan management. |
1569 | </li> | 1556 | </li> |
1570 | <li> | 1557 | <li> |
1571 | Lua 5.2 functions may have a special <tt>_ENV</tt> upvalue if they perform 'global namespace' lookups. Unless special care is taken, this upvalue defaults to the table found at <tt>LUA_RIDX_GLOBALS</tt>. | 1558 | Objects (tables with a metatable) are copyable between lanes. Metatables are assumed to be immutable; they are internally indexed and only copied once per each type of objects per lane. |
1572 | Obviously, we don't want to transfer the whole global table along with each Lua function. Therefore, any upvalue equal to the global table is not transfered by value, but simply bound | ||
1573 | to the global table in the destination state. Note that this also applies when Lanes is built for Lua 5.1, as it doesn't hurt. | ||
1574 | </li> | 1559 | </li> |
1575 | <li> | 1560 | <li> |
1576 | Full userdata can be passed only if it is prepared using the <a href="#deep_userdata">deep userdata</a> system, which handles its lifespan management | 1561 | C functions (<tt>lua_CFunction</tt>) referring to <tt>LUA_ENVIRONINDEX</tt> or <tt>LUA_REGISTRYINDEX</tt> might not do what you expect in the target, since they will actually use a different environment. |
1577 | <ul> | ||
1578 | <li>In particular, lane handles cannot be passed between lanes.</li> | ||
1579 | <li>Lanes can either throw an error or attempt a <a href="#demote_full_userdata">light userdata demotion</a>.</li> | ||
1580 | </ul> | ||
1581 | </li> | 1562 | </li> |
1582 | <li>Coroutines cannot be passed. A coroutine's Lua state is tied to the Lua state that created it, and there is no way the mixed C/Lua stack of a coroutine can be transfered from one Lua state to another.</li> | ||
1583 | <li> | 1563 | <li> |
1584 | If the metatable contains <tt>__lanesconvert</tt>, the object is converted as follows depending on the value: | 1564 | Lua 5.2 functions may have a special <tt>_ENV</tt> upvalue if they perform 'global namespace' lookups. Unless special care is taken, this upvalue defaults to the table found at <tt>LUA_RIDX_GLOBALS</tt>. |
1585 | <ul> | 1565 | Obviously, we don't want to transfer the whole global table along with each Lua function. Therefore, any upvalue equal to the global table is not transfered by value, but simply bound |
1586 | <li><tt>lanes.null</tt>: The value is converted to <tt>nil</tt>.</li> | 1566 | to the global table in the destination state. Note that this also applies when Lanes is built for Lua 5.1, as it doesn't hurt. |
1587 | <li><tt>"decay"</tt>: The value is converted to a light userdata obtained from <tt>lua_topointer()</tt>.</li> | ||
1588 | <li>A function: The function is called as <tt>o:__lanesconvert(string)</tt>, where the argument is either <tt>"keeper"</tt> or <tt>"regular"</tt>, depending on the type of destination. Its (single) return value is the result of the conversion.</li> | ||
1589 | <li>Any other value raises an error.</li> | ||
1590 | </ul> | ||
1591 | </li> | 1567 | </li> |
1592 | </ul> | 1568 | </ul> |
1593 | </p> | 1569 | </p> |