diff options
author | Philipp Janda <siffiejoe@gmx.net> | 2015-01-13 17:54:32 +0100 |
---|---|---|
committer | Philipp Janda <siffiejoe@gmx.net> | 2015-01-13 17:54:32 +0100 |
commit | cc7b56b179cf84364a270463a59aa7d6f74dd35b (patch) | |
tree | a1de23a09aefde76084ffa47d61a51bcf593d6ba | |
parent | 305e7f071a48695e82430a948e931a8419998c4d (diff) | |
download | lua-compat-5.3-cc7b56b179cf84364a270463a59aa7d6f74dd35b.tar.gz lua-compat-5.3-cc7b56b179cf84364a270463a59aa7d6f74dd35b.tar.bz2 lua-compat-5.3-cc7b56b179cf84364a270463a59aa7d6f74dd35b.zip |
add fallback for lua_str2number, readme fix
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | c-api/compat-5.3.c | 4 |
2 files changed, 4 insertions, 1 deletions
@@ -74,7 +74,6 @@ For Lua 5.1 additionally: | |||
74 | * `luaL_fileresult` | 74 | * `luaL_fileresult` |
75 | * `luaL_checkversion` (with empty body, only to avoid compile errors) | 75 | * `luaL_checkversion` (with empty body, only to avoid compile errors) |
76 | * `luaL_tolstring` | 76 | * `luaL_tolstring` |
77 | * `luaL_requiref` | ||
78 | * `lua_pushunsigned`, `lua_tounsignedx`, `lua_tounsigned`, | 77 | * `lua_pushunsigned`, `lua_tounsignedx`, `lua_tounsigned`, |
79 | `luaL_checkunsigned`, `luaL_optunsigned`, if | 78 | `luaL_checkunsigned`, `luaL_optunsigned`, if |
80 | `LUA_COMPAT_APIINTCASTS` is defined. | 79 | `LUA_COMPAT_APIINTCASTS` is defined. |
diff --git a/c-api/compat-5.3.c b/c-api/compat-5.3.c index 9edd5f1..ecb22b0 100644 --- a/c-api/compat-5.3.c +++ b/c-api/compat-5.3.c | |||
@@ -362,6 +362,10 @@ COMPAT53_API void lua_seti (lua_State *L, int index, lua_Integer i) { | |||
362 | } | 362 | } |
363 | 363 | ||
364 | 364 | ||
365 | #if !defined(lua_str2number) | ||
366 | # define lua_str2number(s, p) strtod(s, p) | ||
367 | #endif | ||
368 | |||
365 | COMPAT53_API size_t lua_stringtonumber (lua_State *L, const char *s) { | 369 | COMPAT53_API size_t lua_stringtonumber (lua_State *L, const char *s) { |
366 | char* endptr; | 370 | char* endptr; |
367 | lua_Number n = lua_str2number(s, &endptr); | 371 | lua_Number n = lua_str2number(s, &endptr); |