Lua 5.3 deprecates luaL_checkint, luaL_checklong, luaL_optint, luaL_optlong, which were just convenience macros calling luaL_{check|opt}integer
.
While we can still use them (because of -DLUA_COMPAT_5_2
), they aren't mentioned in the user manual and we're advised to use luaL_{check|opt}integer
"with a type cast".
Now, I'm not an expert in C and I was wondering:
Is a cast needed in simple cases like the following?
int i; i = (int)luaL_checkinteger(L, 1);
If a cast isn't needed here, where is it needed?
Why were those deprecated macros born in the first place if we can do without them? In other words: what did they serve?
Aren't we losing "documentation" by not having the words "int"/"long" embedded in the function name?