pub unsafe extern "C" fn userdata_remapper_wrap(
l: *mut lua_State,
str: *const c_char,
len: usize,
) -> u8Expand description
C trampoline installed into global_State::ecb.gettypemapping so the VM’s
bytecode loader can map userdata type names through the registered remapper.
Mirrors userdataRemapperWrap (CodeGen/src/CodeGenContext.cpp):
static uint8_t userdataRemapperWrap(lua_State* L, const char* str, size_t len) {
if (BaseCodeGenContext* codegenCtx = getCodeGenContext(L)) {
uint8_t index = codegenCtx->userdataRemapper(codegenCtx->userdataRemappingContext, str, len);
if (index < (LBC_TYPE_TAGGED_USERDATA_END - LBC_TYPE_TAGGED_USERDATA_BASE))
return LBC_TYPE_TAGGED_USERDATA_BASE + index;
}
return LBC_TYPE_USERDATA;
}§Safety
l must be a valid lua_State pointer (or null, which is handled). This is
invoked by the VM through a function pointer, hence extern "C".