Should I use lua_tointeger()
, or lua_tonumber()
, when converting Lua numbers to off_t
values?
I checked the source code of Lua itself and I see that their file:seek function uses lua_Number
, not lua_Integer
.
I also see that the luaposix package uses lua_tonumber()
(or luaL_checknumber() etc) extensively, even to read file decriptors(!).
And what about size_t
?
Should I go to the "extreme" and use lua_tonumber()
(and lua_pushnumber()
) for all integral C types (mode_t, size_t, etc.)? Or should I normally use lua_tointeger()
and resort to lua_tonumber()
only when I "feel" it's a potentially big number?