aboutsummaryrefslogtreecommitdiff
path: root/manual
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-12-10 13:46:03 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-12-10 13:46:03 -0200
commit46beca5bed8a7700b18100fe48a78373be5055f9 (patch)
tree499de35c048605434d9adb7ace964adf673041ac /manual
parent28d829c86712ce5bc453feccc5129a32f78d80c0 (diff)
downloadlua-46beca5bed8a7700b18100fe48a78373be5055f9.tar.gz
lua-46beca5bed8a7700b18100fe48a78373be5055f9.tar.bz2
lua-46beca5bed8a7700b18100fe48a78373be5055f9.zip
Better error messages for some polymorphic functions
New auxiliary functions/macros 'luaL_argexpected'/'luaL_typeerror' ease the creation of error messages such as bad argument #2 to 'setmetatable' (nil or table expected, got boolean) (The novelty being the "got boolean" part...)
Diffstat (limited to 'manual')
-rw-r--r--manual/manual.of26
1 files changed, 26 insertions, 0 deletions
diff --git a/manual/manual.of b/manual/manual.of
index 8b5e5d93..0e8e3d72 100644
--- a/manual/manual.of
+++ b/manual/manual.of
@@ -4979,6 +4979,19 @@ This function never returns.
4979 4979
4980} 4980}
4981 4981
4982@APIEntry{
4983void luaL_argexpected (lua_State *L,
4984 int cond,
4985 int arg,
4986 const char *tname);|
4987@apii{0,0,v}
4988
4989Checks whether @id{cond} is true.
4990If it is not, raises an error about the type of the argument @id{arg}
4991with a standard message @seeF{luaL_typeerror}.
4992
4993}
4994
4982@APIEntry{typedef struct luaL_Buffer luaL_Buffer;| 4995@APIEntry{typedef struct luaL_Buffer luaL_Buffer;|
4983 4996
4984Type for a @def{string buffer}. 4997Type for a @def{string buffer}.
@@ -5713,6 +5726,19 @@ to start the traceback.
5713 5726
5714} 5727}
5715 5728
5729@APIEntry{const char *luaL_typeerror (lua_State *L,
5730 int arg,
5731 const char *tname);|
5732@apii{0,0,v}
5733
5734Raises a type error for argument @id{arg}
5735of the @N{C function} that called it,
5736using a standard message;
5737@id{tname} is a @Q{name} for the expected type.
5738This function never returns.
5739
5740}
5741
5716@APIEntry{const char *luaL_typename (lua_State *L, int index);| 5742@APIEntry{const char *luaL_typename (lua_State *L, int index);|
5717@apii{0,0,-} 5743@apii{0,0,-}
5718 5744