diff options
author | Benoit Germain <benoit.germain@ubisoft.com> | 2025-03-11 11:55:01 +0100 |
---|---|---|
committer | Benoit Germain <benoit.germain@ubisoft.com> | 2025-03-11 11:55:01 +0100 |
commit | af3161e5265b56a3d33a1ed45597f85c34806928 (patch) | |
tree | 332101e2a95aebc09f907a73958de923be4b0a4d /docs | |
parent | b1822d8d07f8ee34cef2e7e74391695dd4e1ea81 (diff) | |
download | lanes-af3161e5265b56a3d33a1ed45597f85c34806928.tar.gz lanes-af3161e5265b56a3d33a1ed45597f85c34806928.tar.bz2 lanes-af3161e5265b56a3d33a1ed45597f85c34806928.zip |
Sample module deep test renamed deep_userdata_example
Diffstat (limited to 'docs')
-rw-r--r-- | docs/index.html | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/index.html b/docs/index.html index 49cb592..d7717dc 100644 --- a/docs/index.html +++ b/docs/index.html | |||
@@ -1832,7 +1832,7 @@ static int clonable_lanesclone(lua_State* L) | |||
1832 | <b>NOTE</b>: In the event the source userdata has uservalues, it is not necessary to create them for the clone, Lanes will handle their cloning.<br /> | 1832 | <b>NOTE</b>: In the event the source userdata has uservalues, it is not necessary to create them for the clone, Lanes will handle their cloning.<br /> |
1833 | Of course, more complex objects may require smarter cloning behavior than a simple <tt>memcpy</tt>. Also, the module initialisation code should make each metatable accessible from the module table itself as in: | 1833 | Of course, more complex objects may require smarter cloning behavior than a simple <tt>memcpy</tt>. Also, the module initialisation code should make each metatable accessible from the module table itself as in: |
1834 | <table border="1" bgcolor="#FFFFE0" cellpadding="10" style="width:50%"><tr><td><pre> | 1834 | <table border="1" bgcolor="#FFFFE0" cellpadding="10" style="width:50%"><tr><td><pre> |
1835 | int luaopen_deep_test(lua_State* L) | 1835 | int luaopen_deep_userdata_example(lua_State* L) |
1836 | { | 1836 | { |
1837 | luaL_newlib(L, deep_module); | 1837 | luaL_newlib(L, deep_module); |
1838 | 1838 | ||
@@ -1898,7 +1898,7 @@ static MyDeepFactory g_MyDeepFactory; | |||
1898 | <li><tt>createMetatable()</tt>: should build a metatable for the object. Don't cache the metatable yourself, Lanes takes care of it (<tt>createMetatable</tt> should only be invoked once per state). Just push the metatable on the stack.</li> | 1898 | <li><tt>createMetatable()</tt>: should build a metatable for the object. Don't cache the metatable yourself, Lanes takes care of it (<tt>createMetatable</tt> should only be invoked once per state). Just push the metatable on the stack.</li> |
1899 | <li><tt>moduleName()</tt>: requests the name of the module that exports the factory, 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 factory pointer is still held.</li> | 1899 | <li><tt>moduleName()</tt>: requests the name of the module that exports the factory, 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 factory pointer is still held.</li> |
1900 | </ul> | 1900 | </ul> |
1901 | Take a look at <tt>LindaFactory</tt> in <tt>lindafactory.cpp</tt> or <tt>MyDeepFactory</tt> in <tt>deep_test.cpp</tt>. | 1901 | Take a look at <tt>LindaFactory</tt> in <tt>lindafactory.cpp</tt> or <tt>MyDeepFactory</tt> in <tt>deep_userdata_example.cpp</tt>. |
1902 | </li> | 1902 | </li> |
1903 | <li>Include <tt>"_pch.hpp", "deep.hpp"</tt> and either link against Lanes or statically compile <tt>compat.cpp deep.cpp</tt> into your module if you want to avoid a runtime dependency for users that will use your module without Lanes. | 1903 | <li>Include <tt>"_pch.hpp", "deep.hpp"</tt> and either link against Lanes or statically compile <tt>compat.cpp deep.cpp</tt> into your module if you want to avoid a runtime dependency for users that will use your module without Lanes. |
1904 | <li>Instanciate your userdata using <tt>yourFactoryObject.pushDeepUserdata()</tt>, instead of the regular <tt>lua_newuserdata()</tt>. Given a <tt>factory</tt>, it sets up the support structures and returns a state-specific proxy full userdata for accessing your data. This proxy can also be copied over to other lanes.</li> | 1904 | <li>Instanciate your userdata using <tt>yourFactoryObject.pushDeepUserdata()</tt>, instead of the regular <tt>lua_newuserdata()</tt>. Given a <tt>factory</tt>, it sets up the support structures and returns a state-specific proxy full userdata for accessing your data. This proxy can also be copied over to other lanes.</li> |