Skip to content

What tag does LBC_TYPE_TAGGED_USERDATA_BASE map to? #1885

Answered by vegorov-rbx
jackdotink asked this question in Q&A
Discussion options

You must be logged in to vote

In the compilation options, you specify the array of userdata type names that you wish to detect later in CodeGen lowering.

From the compilation options struct:

// null-terminated array of userdata types that will be included in the type information
const char* const* userdataTypes;

Example use:

static const char* kUserdataCompileTypes[] = {"vec2", "color", "mat3", nullptr};
copts.userdataTypes = kUserdataCompileTypes;

Later, you provide a re-mapper to provide type indices you need at runtime using Luau::CodeGen::setUserdataRemapper.
This is needed because bytecode and runtime might be out of sync (runtime optimizing for new types that bytecode wasn't compiled for or the other way around).

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by jackdotink
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants