diff options
| author | Benoit Germain <benoit.germain@ubisoft.com> | 2025-09-29 17:11:58 +0200 |
|---|---|---|
| committer | Benoit Germain <benoit.germain@ubisoft.com> | 2025-09-29 17:11:58 +0200 |
| commit | f011dcafb0f583c89ed9971238fd83ddcbdb5438 (patch) | |
| tree | e118ea27af987540fccb2cb1563cc8d9508b255c /docs | |
| parent | 4e109a0c12d245b155bf03cb561c01b242666395 (diff) | |
| download | lanes-f011dcafb0f583c89ed9971238fd83ddcbdb5438.tar.gz lanes-f011dcafb0f583c89ed9971238fd83ddcbdb5438.tar.bz2 lanes-f011dcafb0f583c89ed9971238fd83ddcbdb5438.zip | |
Lift restriction on tables as table keys
As demonstrated by the unit tests, there is no problem with using a table as a table key
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/index.html | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/docs/index.html b/docs/index.html index eba39bb..452dcfa 100644 --- a/docs/index.html +++ b/docs/index.html | |||
| @@ -1936,13 +1936,12 @@ | |||
| 1936 | </p> | 1936 | </p> |
| 1937 | 1937 | ||
| 1938 | <table border="1" bgcolor="#FFFFE0" cellpadding="10" style="width:50%"><tr><td><pre> | 1938 | <table border="1" bgcolor="#FFFFE0" cellpadding="10" style="width:50%"><tr><td><pre> |
| 1939 | int luaopen_module(lua_State *L ) | 1939 | int luaopen_module(lua_State* L) |
| 1940 | { | 1940 | { |
| 1941 | static char been_here; /* 0 by ANSI C */ | 1941 | static char been_here; /* 0 by ANSI C */ |
| 1942 | 1942 | ||
| 1943 | // Calls to 'require' serialized by Lanes; this is safe. | 1943 | // Calls to 'require' serialized by Lanes; this is safe. |
| 1944 | if (!been_here) | 1944 | if (!been_here) { |
| 1945 | { | ||
| 1946 | been_here= 1; | 1945 | been_here= 1; |
| 1947 | ... one time initializations ... | 1946 | ... one time initializations ... |
| 1948 | } | 1947 | } |
| @@ -1959,8 +1958,7 @@ | |||
| 1959 | <table border="1" bgcolor="#FFFFE0" cellpadding="10" style="width:50%"><tr><td><pre> | 1958 | <table border="1" bgcolor="#FFFFE0" cellpadding="10" style="width:50%"><tr><td><pre> |
| 1960 | static int clonable_lanesclone(lua_State* L) | 1959 | static int clonable_lanesclone(lua_State* L) |
| 1961 | { | 1960 | { |
| 1962 | switch(lua_gettop(L)) | 1961 | switch(lua_gettop(L)) { |
| 1963 | { | ||
| 1964 | case 3: | 1962 | case 3: |
| 1965 | { | 1963 | { |
| 1966 | struct s_MyClonableUserdata* self = lua_touserdata(L, 1); | 1964 | struct s_MyClonableUserdata* self = lua_touserdata(L, 1); |
| @@ -1988,16 +1986,14 @@ int luaopen_deep_userdata_example(lua_State* L) | |||
| 1988 | luaL_newlib(L, deep_module); | 1986 | luaL_newlib(L, deep_module); |
| 1989 | 1987 | ||
| 1990 | // preregister the metatables for the types we can instanciate so that Lanes can know about them | 1988 | // preregister the metatables for the types we can instanciate so that Lanes can know about them |
| 1991 | if (luaL_newmetatable(L, "clonable")) | 1989 | if (luaL_newmetatable(L, "clonable")) { |
| 1992 | { | ||
| 1993 | luaL_setfuncs(L, clonable_mt, 0); | 1990 | luaL_setfuncs(L, clonable_mt, 0); |
| 1994 | lua_pushvalue(L, -1); | 1991 | lua_pushvalue(L, -1); |
| 1995 | lua_setfield(L, -2, "__index"); | 1992 | lua_setfield(L, -2, "__index"); |
| 1996 | } | 1993 | } |
| 1997 | lua_setfield(L, -2, "__clonableMT"); // actual name is not important | 1994 | lua_setfield(L, -2, "__clonableMT"); // actual name is not important |
| 1998 | 1995 | ||
| 1999 | if (luaL_newmetatable(L, "deep")) | 1996 | if (luaL_newmetatable(L, "deep")) { |
| 2000 | { | ||
| 2001 | luaL_setfuncs(L, deep_mt, 0); | 1997 | luaL_setfuncs(L, deep_mt, 0); |
| 2002 | lua_pushvalue(L, -1); | 1998 | lua_pushvalue(L, -1); |
| 2003 | lua_setfield(L, -2, "__index"); | 1999 | lua_setfield(L, -2, "__index"); |
