diff options
author | Benoit Germain <bnt period germain arrobase gmail period com> | 2014-06-17 16:34:31 +0200 |
---|---|---|
committer | Benoit Germain <bnt period germain arrobase gmail period com> | 2014-06-17 16:34:31 +0200 |
commit | f18044c22975d0c0dfebf13d472029ca154261c0 (patch) | |
tree | c3b2cb609fcf2e4f840146b1b16ca088dd8cfc86 | |
parent | 02cace23a4886a03833bb3b7842f84ddfaefe288 (diff) | |
download | lanes-f18044c22975d0c0dfebf13d472029ca154261c0.tar.gz lanes-f18044c22975d0c0dfebf13d472029ca154261c0.tar.bz2 lanes-f18044c22975d0c0dfebf13d472029ca154261c0.zip |
Deep userdata changes
* bumped version to 3.9.6
* separate deep userdata code in a dedicated file to allow external
modules to implement Lanes-compatible deep userdata without requiring a
binary dependency against the Lanes module. because of this linda_id
function(eDO_metatable) must push 2 values on the stack: a metatable and
a deep version string obtained from luaG_pushdeepversion()
-rw-r--r-- | index.html | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -70,7 +70,7 @@ | |||
70 | </p> | 70 | </p> |
71 | 71 | ||
72 | <p> | 72 | <p> |
73 | This document was revised on 20-Mar-14, and applies to version <tt>3.9.4</tt>. | 73 | This document was revised on 17-Jun-14, and applies to version <tt>3.9.6</tt>. |
74 | </p> | 74 | </p> |
75 | </font> | 75 | </font> |
76 | </center> | 76 | </center> |
@@ -1511,12 +1511,12 @@ events to a common Linda, but... :).</font> | |||
1511 | <ul> | 1511 | <ul> |
1512 | <li><tt>eDO_new</tt>: requests the creation of a new object, whose pointer is returned.</li> | 1512 | <li><tt>eDO_new</tt>: requests the creation of a new object, whose pointer is returned.</li> |
1513 | <li><tt>eDO_delete</tt>: receives this same pointer on the stack as a light userdata, and should cleanup the object.</li> | 1513 | <li><tt>eDO_delete</tt>: receives this same pointer on the stack as a light userdata, and should cleanup the object.</li> |
1514 | <li><tt>eDO_metatable</tt>: should build a metatable for the object. Don't cache the metatable yourself, Lanes takes care of it (<tt>eDO_metatable</tt> should only be invoked once per state).</li> | 1514 | <li><tt>eDO_metatable</tt>: should build a metatable for the object. Don't cache the metatable yourself, Lanes takes care of it (<tt>eDO_metatable</tt> should only be invoked once per state). Push the metatable on the stack, then call <tt>luaG_pushdeepversion()</tt> before returning (new in version 3.9.5).</li> |
1515 | <li><tt>eDO_module</tt>: requests the name of the module that exports the idfunc, to be returned. It is necessary so that Lanes can require it in any lane state that receives a userdata. This is to prevent crashes in situations where the module could be unloaded while the idfunc pointer is still held.</li> | 1515 | <li><tt>eDO_module</tt>: requests the name of the module that exports the idfunc, to be returned. It is necessary so that Lanes can require it in any lane state that receives a userdata. This is to prevent crashes in situations where the module could be unloaded while the idfunc pointer is still held.</li> |
1516 | </ul> | 1516 | </ul> |
1517 | Take a look at <tt>linda_id</tt> in <tt>lanes.c</tt>. | 1517 | Take a look at <tt>linda_id</tt> in <tt>lanes.c</tt>. |
1518 | </li> | 1518 | </li> |
1519 | <li>Include <tt>"deep.h"</tt> and link against Lanes. | 1519 | <li>Include <tt>"deep.h"</tt> and either link against Lanes or statically compile deep.c into your module if you want to avoid a runtime dependency for users that will use your module without Lanes. |
1520 | <li>Instanciate your userdata using <tt>luaG_newdeepuserdata()</tt>, instead of the regular <tt>lua_newuserdata()</tt>. Given an <tt>idfunc</tt>, it sets up the support structures and returns a state-specific proxy userdata for accessing your data. This proxy can also be copied over to other lanes.</li> | 1520 | <li>Instanciate your userdata using <tt>luaG_newdeepuserdata()</tt>, instead of the regular <tt>lua_newuserdata()</tt>. Given an <tt>idfunc</tt>, it sets up the support structures and returns a state-specific proxy userdata for accessing your data. This proxy can also be copied over to other lanes.</li> |
1521 | <li>Accessing the deep userdata from your C code, use <tt>luaG_todeep()</tt> instead of the regular <tt>lua_touserdata()</tt>.</li> | 1521 | <li>Accessing the deep userdata from your C code, use <tt>luaG_todeep()</tt> instead of the regular <tt>lua_touserdata()</tt>.</li> |
1522 | </ol> | 1522 | </ol> |