Several small improvements (code style, warnings, comments, more tests),
in particular:

- 'lua_topointer' extended to handle strings
- raises an error in 'string.format("%10q")' ('%q' with modifiers)
- in the manual for 'string.format', the term "option" replaced by
  "conversion specifier" (the term used by the C standard)
This commit is contained in:
Roberto Ierusalimschy
2019-03-13 13:16:53 -03:00
parent 2c32bff609
commit cf71a5ddc7
8 changed files with 87 additions and 51 deletions

View File

@@ -164,7 +164,7 @@ typedef union Header {
Memcontrol l_memcontrol =
{0L, 0L, 0L, 0L, (~0L), {0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L}};
{0UL, 0UL, 0UL, 0UL, (~0UL), {0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL, 0UL}};
static void freeblock (Memcontrol *mc, Header *block) {
@@ -1596,7 +1596,10 @@ static struct X { int x; } x;
lua_pushnumber(L1, lua_tonumber(L1, getindex));
}
else if EQ("topointer") {
lua_pushnumber(L1, cast_sizet(lua_topointer(L1, getindex)));
lua_pushlightuserdata(L1, cast_voidp(lua_topointer(L1, getindex)));
}
else if EQ("touserdata") {
lua_pushlightuserdata(L1, lua_touserdata(L1, getindex));
}
else if EQ("tostring") {
const char *s = lua_tostring(L1, getindex);