diff options
Diffstat (limited to 'src/intercopycontext.cpp')
-rw-r--r-- | src/intercopycontext.cpp | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/src/intercopycontext.cpp b/src/intercopycontext.cpp index a5fd400..5be4304 100644 --- a/src/intercopycontext.cpp +++ b/src/intercopycontext.cpp | |||
@@ -718,6 +718,8 @@ LuaType InterCopyContext::processConversion() const | |||
718 | return false; | 718 | return false; |
719 | } | 719 | } |
720 | 720 | ||
721 | DEBUGSPEW_CODE(DebugSpew(U) << "CLONABLE USERDATA" << std::endl); | ||
722 | |||
721 | // we need to copy over the uservalues of the userdata as well | 723 | // we need to copy over the uservalues of the userdata as well |
722 | { | 724 | { |
723 | int const _mt{ luaG_absindex(L1, -2) }; // L1: ... mt __lanesclone | 725 | int const _mt{ luaG_absindex(L1, -2) }; // L1: ... mt __lanesclone |
@@ -795,6 +797,7 @@ LuaType InterCopyContext::processConversion() const | |||
795 | return false; // not a deep userdata | 797 | return false; // not a deep userdata |
796 | } | 798 | } |
797 | 799 | ||
800 | DEBUGSPEW_CODE(DebugSpew(U) << "DEEP USERDATA" << std::endl); | ||
798 | STACK_CHECK_START_REL(L1, 0); | 801 | STACK_CHECK_START_REL(L1, 0); |
799 | STACK_CHECK_START_REL(L2, 0); | 802 | STACK_CHECK_START_REL(L2, 0); |
800 | 803 | ||
@@ -1085,27 +1088,13 @@ LuaType InterCopyContext::processConversion() const | |||
1085 | STACK_CHECK(L2, 0); | 1088 | STACK_CHECK(L2, 0); |
1086 | 1089 | ||
1087 | // Allow only deep userdata entities to be copied across | 1090 | // Allow only deep userdata entities to be copied across |
1088 | DEBUGSPEW_CODE(DebugSpew(nullptr) << "USERDATA" << std::endl); | ||
1089 | if (tryCopyDeep()) { | 1091 | if (tryCopyDeep()) { |
1090 | STACK_CHECK(L1, 0); | 1092 | STACK_CHECK(L1, 0); |
1091 | STACK_CHECK(L2, 1); | 1093 | STACK_CHECK(L2, 1); |
1092 | return true; | 1094 | return true; |
1093 | } | 1095 | } |
1094 | 1096 | ||
1095 | STACK_CHECK(L1, 0); | 1097 | raise_luaL_error(getErrL(), "can't copy non-deep full userdata across lanes"); |
1096 | STACK_CHECK(L2, 0); | ||
1097 | |||
1098 | // Not a deep or clonable full userdata | ||
1099 | if (U->demoteFullUserdata) { // attempt demotion to light userdata | ||
1100 | void* const _lud{ lua_touserdata(L1, L1_i) }; | ||
1101 | lua_pushlightuserdata(L2, _lud); | ||
1102 | } else { // raise an error | ||
1103 | raise_luaL_error(getErrL(), "can't copy non-deep full userdata across lanes"); | ||
1104 | } | ||
1105 | |||
1106 | STACK_CHECK(L2, 1); | ||
1107 | STACK_CHECK(L1, 0); | ||
1108 | return true; | ||
1109 | } | 1098 | } |
1110 | 1099 | ||
1111 | // ################################################################################################# | 1100 | // ################################################################################################# |