Stefano
unread,Jun 9, 2025, 9:47:46 AMJun 9Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to lua-l
Hello,
I have read about a new <const> keyword in 5.4 to define constants. I am
wondering how I could leverage this to create module-level constants in
the C API, as in:
int luaopen_mymod (lua_State *L)
{
lua_newlib (L, my_mod_functions);
lua_pushinteger (L, MY_C_ENUM_OR_DEFINE);
lua_setfield (L, "MY_CONST", -2);
return 1;
}
Is there a way to protect mymod.MY_CONST from overwrite using the new
feature?
Thanks,
Stefano