summaryrefslogtreecommitdiff
path: root/strlib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-03-19 19:28:37 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>1996-03-19 19:28:37 -0300
commita275d9a25b161af426696d7b73d46f91150309c9 (patch)
tree763a5694213fe30b231bc81777cec71828935696 /strlib.c
parent7e0be1fbde80d72886e11bcbf114a8dbf6d5e1d9 (diff)
downloadlua-github-a275d9a25b161af426696d7b73d46f91150309c9.tar.gz
functions "lua_is..." consider coercions.
Diffstat (limited to 'strlib.c')
-rw-r--r--strlib.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/strlib.c b/strlib.c
index 59d855a4..93965b76 100644
--- a/strlib.c
+++ b/strlib.c
@@ -3,7 +3,7 @@
** String library to LUA
*/
-char *rcs_strlib="$Id: strlib.c,v 1.18 1996/02/12 18:34:44 roberto Exp roberto $";
+char *rcs_strlib="$Id: strlib.c,v 1.19 1996/03/14 15:52:35 roberto Exp roberto $";
#include <string.h>
#include <stdio.h>
@@ -24,7 +24,7 @@ void lua_arg_error(char *funcname)
char *lua_check_string (int numArg, char *funcname)
{
lua_Object o = lua_getparam(numArg);
- if (!(lua_isstring(o) || lua_isnumber(o)))
+ if (!lua_isstring(o))
lua_arg_error(funcname);
return lua_getstring(o);
}
@@ -32,17 +32,9 @@ char *lua_check_string (int numArg, char *funcname)
double lua_check_number (int numArg, char *funcname)
{
lua_Object o = lua_getparam(numArg);
- if (lua_isnumber(o))
- return lua_getnumber(o);
- else if (lua_isstring(o))
- {
- float t;
- char c;
- if (sscanf(lua_getstring(o), "%f %c",&t, &c) == 1)
- return t;
- }
- lua_arg_error(funcname);
- return 0; /* to avoid warnings */
+ if (!lua_isnumber(o))
+ lua_arg_error(funcname);
+ return lua_getnumber(o);
}
char *luaI_addchar (int c)