diff options
author | Benoit Germain <bnt.germain@gmail.com> | 2022-03-01 14:51:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-01 14:51:49 +0100 |
commit | 91f4ba9efae4ad478578bd5ff489ac1c48179509 (patch) | |
tree | f13e3f84b684a5d8ae5362b12226a0582afd5e58 | |
parent | 61f1b4aa0f7e87a3f3e1de0bef6e64c5dee21138 (diff) | |
parent | 96b6ad6b2a1a513c4e763f868538c85f72080fdd (diff) | |
download | lanes-91f4ba9efae4ad478578bd5ff489ac1c48179509.tar.gz lanes-91f4ba9efae4ad478578bd5ff489ac1c48179509.tar.bz2 lanes-91f4ba9efae4ad478578bd5ff489ac1c48179509.zip |
Merge pull request #208 from eligovision/lanes_lanesclone3args_fixv3.16.0
Bug in __lanesclone with 3 parameters mechanism fixed (index was wron…
-rw-r--r-- | src/tools.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/tools.c b/src/tools.c index a297913..2c8a9f0 100644 --- a/src/tools.c +++ b/src/tools.c | |||
@@ -1674,10 +1674,10 @@ static bool_t inter_copy_function( Universe* U, lua_State* L2, uint_t L2_cache_i | |||
1674 | 1674 | ||
1675 | // this function has 2 upvalues: the fqn of its metatable, and the userdata itself | 1675 | // this function has 2 upvalues: the fqn of its metatable, and the userdata itself |
1676 | lookup_table( L2, L, source_i_, mode_, upName_); // ... mt | 1676 | lookup_table( L2, L, source_i_, mode_, upName_); // ... mt |
1677 | // originally 'i' slot was the proxy closure, but from now on it indexes the actual userdata we extracted from it | 1677 | // originally 'source_i_' slot was the proxy closure, but from now on it indexes the actual userdata we extracted from it |
1678 | source_i_ = lua_gettop( L); | 1678 | source_i_ = lua_gettop( L); |
1679 | source = lua_touserdata( L, -1); | 1679 | source = lua_touserdata( L, -1); |
1680 | // call the cloning function with 1 argument, should return the number of bytes to allocate for the clone | 1680 | // get the number of bytes to allocate for the clone |
1681 | userdata_size = (size_t) lua_rawlen( L, -1); | 1681 | userdata_size = (size_t) lua_rawlen( L, -1); |
1682 | { | 1682 | { |
1683 | // extract uservalues (don't transfer them yet) | 1683 | // extract uservalues (don't transfer them yet) |
@@ -1713,12 +1713,12 @@ static bool_t inter_copy_function( Universe* U, lua_State* L2, uint_t L2_cache_i | |||
1713 | // perform the custom cloning part | 1713 | // perform the custom cloning part |
1714 | lua_insert( L2, -2); // ... u mt | 1714 | lua_insert( L2, -2); // ... u mt |
1715 | // __lanesclone should always exist because we wouldn't be restoring data from a userdata_clone_sentinel closure to begin with | 1715 | // __lanesclone should always exist because we wouldn't be restoring data from a userdata_clone_sentinel closure to begin with |
1716 | lua_getfield(L2, -2, "__lanesclone"); // ... u mt __lanesclone | 1716 | lua_getfield(L2, -1, "__lanesclone"); // ... u mt __lanesclone |
1717 | lua_remove( L2, -2); // ... u __lanesclone | 1717 | lua_remove( L2, -2); // ... u __lanesclone |
1718 | lua_pushlightuserdata( L2, clone); // ... u __lanesclone clone | 1718 | lua_pushlightuserdata( L2, clone); // ... u __lanesclone clone |
1719 | lua_pushlightuserdata( L2, source); // ... u __lanesclone clone source | 1719 | lua_pushlightuserdata( L2, source); // ... u __lanesclone clone source |
1720 | lua_pushinteger( L2, userdata_size); // ... u __lanesclone clone source size | 1720 | lua_pushinteger( L2, userdata_size); // ... u __lanesclone clone source size |
1721 | // clone:__lanesclone(source, size) | 1721 | // clone:__lanesclone(dest, source, size) |
1722 | lua_call( L2, 3, 0); // ... u | 1722 | lua_call( L2, 3, 0); // ... u |
1723 | } | 1723 | } |
1724 | else // regular function | 1724 | else // regular function |