FFI: Fix __tostring metamethod access to enum cdata value.

Thanks to Sergey Kaplun. #1232
This commit is contained in:
Mike Pall 2024-07-03 23:43:57 +02:00
parent 0f8b878e2f
commit f2a1cd4328

View File

@ -304,7 +304,7 @@ LJLIB_CF(ffi_meta___tostring)
p = *(void **)p; p = *(void **)p;
} else if (ctype_isenum(ct->info)) { } else if (ctype_isenum(ct->info)) {
msg = "cdata<%s>: %d"; msg = "cdata<%s>: %d";
p = (void *)(uintptr_t)*(uint32_t **)p; p = (void *)(uintptr_t)*(uint32_t *)p;
} else { } else {
if (ctype_isptr(ct->info)) { if (ctype_isptr(ct->info)) {
p = cdata_getptr(p, ct->size); p = cdata_getptr(p, ct->size);