In some places you use assign the return value of lua_tonumber() to int without a cast. That makes it unclear whether that is intentional or just a mistake... In other places you do assign lua_tonumber() to a lua_Number type.
The reason to be explicit: when you introduce lua_tonumber() around table 2.3, you mention of its return type being lua_Number. But in the referenced listing that is not visible (readers just see int), and there is no comment about the cast.
Also, is there a reason to not use lua_tointeger() and corresponding lua_Integer?
In some places you use assign the return value of
lua_tonumber()to int without a cast. That makes it unclear whether that is intentional or just a mistake... In other places you do assignlua_tonumber()to alua_Numbertype.The reason to be explicit: when you introduce
lua_tonumber()around table 2.3, you mention of its return type beinglua_Number. But in the referenced listing that is not visible (readers just seeint), and there is no comment about the cast.Also, is there a reason to not use
lua_tointeger()and correspondinglua_Integer?