|
@@ -1,5 +1,5 @@
|
|
|
/*
|
|
|
-** $Id: lobject.c,v 2.20 2005/12/22 16:19:56 roberto Exp roberto $
|
|
|
+** $Id: lobject.c,v 2.21 2006/01/10 12:50:00 roberto Exp roberto $
|
|
|
** Some generic functions over Lua objects
|
|
|
** See Copyright Notice in lua.h
|
|
|
*/
|
|
@@ -91,6 +91,8 @@ int luaO_str2d (const char *s, lua_Number *result) {
|
|
|
char *endptr;
|
|
|
*result = lua_str2number(s, &endptr);
|
|
|
if (endptr == s) return 0; /* conversion failed */
|
|
|
+ if (*endptr == 'x' || *endptr == 'X') /* maybe an hexadecimal constant? */
|
|
|
+ *result = cast_num(strtoul(s, &endptr, 16));
|
|
|
if (*endptr == '\0') return 1; /* most common case */
|
|
|
while (isspace(cast(unsigned char, *endptr))) endptr++;
|
|
|
if (*endptr != '\0') return 0; /* invalid trailing characters? */
|