fixed "00" -> 0 bug. (Lua related)

lua_tointeger auto-converts string to integer, so I used lua_type to
explicitly check type of number.