diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-05-16 18:19:00 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-05-16 18:19:00 -0300 |
| commit | c2bb9abceceef125554595e23b7cc18ad3555c7c (patch) | |
| tree | 2c00262ddf0e4f8acc1db83bdee4a56bb2458117 /lauxlib.c | |
| parent | da32450c3d4c8abd3fd6709692859a12a8886511 (diff) | |
| download | lua-c2bb9abceceef125554595e23b7cc18ad3555c7c.tar.gz lua-c2bb9abceceef125554595e23b7cc18ad3555c7c.tar.bz2 lua-c2bb9abceceef125554595e23b7cc18ad3555c7c.zip | |
better quotes for strings in error messages
Diffstat (limited to 'lauxlib.c')
| -rw-r--r-- | lauxlib.c | 12 |
1 files changed, 7 insertions, 5 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.c,v 1.130 2005/03/16 16:58:41 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.131 2005/05/16 19:21:11 roberto Exp roberto $ |
| 3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -47,11 +47,12 @@ LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) { | |||
| 47 | if (strcmp(ar.namewhat, "method") == 0) { | 47 | if (strcmp(ar.namewhat, "method") == 0) { |
| 48 | narg--; /* do not count `self' */ | 48 | narg--; /* do not count `self' */ |
| 49 | if (narg == 0) /* error is in the self argument itself? */ | 49 | if (narg == 0) /* error is in the self argument itself? */ |
| 50 | return luaL_error(L, "calling `%s' on bad self (%s)", ar.name, extramsg); | 50 | return luaL_error(L, "calling " LUA_SM " on bad self (%s)", |
| 51 | ar.name, extramsg); | ||
| 51 | } | 52 | } |
| 52 | if (ar.name == NULL) | 53 | if (ar.name == NULL) |
| 53 | ar.name = "?"; | 54 | ar.name = "?"; |
| 54 | return luaL_error(L, "bad argument #%d to `%s' (%s)", | 55 | return luaL_error(L, "bad argument #%d to " LUA_SM " (%s)", |
| 55 | narg, ar.name, extramsg); | 56 | narg, ar.name, extramsg); |
| 56 | } | 57 | } |
| 57 | 58 | ||
| @@ -244,7 +245,7 @@ LUALIB_API void luaL_openlib (lua_State *L, const char *libname, | |||
| 244 | luaL_setfield(L, LUA_GLOBALSINDEX, libname); | 245 | luaL_setfield(L, LUA_GLOBALSINDEX, libname); |
| 245 | } | 246 | } |
| 246 | else if (!lua_istable(L, -1)) | 247 | else if (!lua_istable(L, -1)) |
| 247 | luaL_error(L, "name conflict for library `%s'", libname); | 248 | luaL_error(L, "name conflict for library " LUA_SM, libname); |
| 248 | lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); | 249 | lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); |
| 249 | lua_pushvalue(L, -2); | 250 | lua_pushvalue(L, -2); |
| 250 | lua_setfield(L, -2, libname); /* _LOADED[modname] = new table */ | 251 | lua_setfield(L, -2, libname); /* _LOADED[modname] = new table */ |
| @@ -365,7 +366,8 @@ LUALIB_API const char *luaL_searchpath (lua_State *L, const char *name, | |||
| 365 | for (;;) { | 366 | for (;;) { |
| 366 | const char *fname; | 367 | const char *fname; |
| 367 | if ((p = pushnexttemplate(L, p)) == NULL) { | 368 | if ((p = pushnexttemplate(L, p)) == NULL) { |
| 368 | lua_pushfstring(L, "no readable `%s' in path `%s'", name, path); | 369 | lua_pushfstring(L, "no readable " LUA_SM " in path " LUA_SM "", |
| 370 | name, path); | ||
| 369 | return NULL; | 371 | return NULL; |
| 370 | } | 372 | } |
| 371 | fname = luaL_gsub(L, lua_tostring(L, -1), LUA_PATH_MARK, name); | 373 | fname = luaL_gsub(L, lua_tostring(L, -1), LUA_PATH_MARK, name); |
