APIsWithLua
APIsWithLua copied to clipboard
might want to clarify the usage of return type for lua_tonumber()
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
?