History

Lua 5.1-rc4

Lua Team committed 20 years ago

Commit 4e079f61 parent 010ebd07 files · +34 −35Browse files

Showing the changes to src/lobject.c (1 of 7 files). Show all

Unified · Split

src/lobject.c+3−1
@@ -1,5 +1,5 @@
11 /*
2−** $Id: lobject.c,v 2.21 2006/01/10 12:50:00 roberto Exp $
2+** $Id: lobject.c,v 2.22 2006/02/10 17:43:52 roberto Exp $
33 ** Some generic functions over Lua objects
44 ** See Copyright Notice in lua.h
55 */
@@ -91,6 +91,8 @@ int luaO_str2d (const char *s, lua_Number *result) { · 85 unmodified lines
9191 char *endptr;
9292 *result = lua_str2number(s, &endptr);
9393 if (endptr == s) return 0; /* conversion failed */
94+ if (*endptr == 'x' || *endptr == 'X') /* maybe an hexadecimal constant? */
95+ *result = cast_num(strtoul(s, &endptr, 16));
9496 if (*endptr == '\0') return 1; /* most common case */
9597 while (isspace(cast(unsigned char, *endptr))) endptr++;
9698 if (*endptr != '\0') return 0; /* invalid trailing characters? */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t