lua_tonumber

lua_Number lua_tonumber (lua_State *L, int index);

Converts the Lua value at the given acceptable index to a number (see lua_Number). The Lua value must be a number or a string convertible to a number (see §2.2.1); otherwise, lua_tonumber returns 0.