aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/index.html27
1 files changed, 25 insertions, 2 deletions
diff --git a/docs/index.html b/docs/index.html
index 03c91f7..a28dd41 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -799,8 +799,31 @@ can be used for custom userdata as well. Here's what to do.
799</p> 799</p>
800<ol> 800<ol>
801 <li>Provide an <i>identity function</i> for your userdata, in C. This function is 801 <li>Provide an <i>identity function</i> for your userdata, in C. This function is
802used for creation and deletion of your deep userdata (the shared resource), 802 used for creation and deletion of your deep userdata (the shared resource),
803and for making metatables for the state-specific proxies for accessing it. 803 and for making metatables for the state-specific proxies for accessing it. The
804 prototype is
805 <table border="1" bgcolor="#E0E0FF" cellpadding="10">
806 <tr>
807 <td>
808 <code>void idfunc( lua_State *L, char const * const which);</code>
809 </table>
810<tt>which</tt> can be one of:
811<ul>
812 <li>
813 <tt>"new"</tt>: requests the creation of a new object, whose pointer is pushed on the stack
814 as a light userdata.
815 </li>
816 <li>
817 <tt>"delete"</tt>: receives this same pointer on the stack, and should cleanup the object.</li>
818 <li>
819 <tt>"metatable"</tt>: should build a metatable for the object. Don't cache the metatable
820yourself, Lanes takes care of it ("metatable" should only be invoked once).</li>
821 <li>
822 <tt>"module"</tt>: is the name of the module that exports the idfunc,
823to be pushed on the stack as a string. It is necessary so that Lanes can require it in
824any Lane and keeper state that receives a userdata. This is to prevent crashes in situations
825where the module could be unloaded while the idfunc pointer is still held.</li>
826</ul>
804Take a look at <tt>linda_id</tt> in <tt>lanes.c</tt>. 827Take a look at <tt>linda_id</tt> in <tt>lanes.c</tt>.
805 </li> 828 </li>
806 <li>Instanciate your userdata using <tt>luaG_deep_userdata()</tt>, 829 <li>Instanciate your userdata using <tt>luaG_deep_userdata()</tt>,