diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-06-18 13:57:03 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1998-06-18 13:57:03 -0300 |
commit | c9902be294f5c2dca8a67a67fd324f91e4352c0a (patch) | |
tree | 3f3ef43d231334ee60c13bf310f7995845e97cab /lauxlib.c | |
parent | 112c9d53ab47e77fd09d4ecb9b11d432ed906c88 (diff) | |
download | lua-c9902be294f5c2dca8a67a67fd324f91e4352c0a.tar.gz lua-c9902be294f5c2dca8a67a67fd324f91e4352c0a.tar.bz2 lua-c9902be294f5c2dca8a67a67fd324f91e4352c0a.zip |
"findname" moved from lobject.c to lauxlib.c (so libraries may use it).
Diffstat (limited to 'lauxlib.c')
-rw-r--r-- | lauxlib.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.9 1998/03/06 16:54:42 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.10 1998/03/06 18:47:42 roberto Exp roberto $ |
3 | ** Auxiliar functions for building Lua libraries | 3 | ** Auxiliar functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #include <stdarg.h> | 8 | #include <stdarg.h> |
9 | #include <stdio.h> | 9 | #include <stdio.h> |
10 | #include <string.h> | ||
10 | 11 | ||
11 | /* Please Notice: This file uses only the oficial API of Lua | 12 | /* Please Notice: This file uses only the oficial API of Lua |
12 | ** Any function declared here could be written as an application | 13 | ** Any function declared here could be written as an application |
@@ -18,6 +19,14 @@ | |||
18 | 19 | ||
19 | 20 | ||
20 | 21 | ||
22 | int luaL_findstring (char *name, char *list[]) { | ||
23 | int i; | ||
24 | for (i=0; list[i]; i++) | ||
25 | if (strcmp(list[i], name) == 0) | ||
26 | return i; | ||
27 | return -1; /* name not found */ | ||
28 | } | ||
29 | |||
21 | void luaL_argerror (int numarg, char *extramsg) | 30 | void luaL_argerror (int numarg, char *extramsg) |
22 | { | 31 | { |
23 | char *funcname; | 32 | char *funcname; |