diff options
Diffstat (limited to 'strlib.c')
| -rw-r--r-- | strlib.c | 15 |
1 files changed, 4 insertions, 11 deletions
| @@ -3,7 +3,7 @@ | |||
| 3 | ** String library to LUA | 3 | ** String library to LUA |
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | char *rcs_strlib="$Id: strlib.c,v 1.35 1997/02/21 15:21:34 roberto Exp roberto $"; | 6 | char *rcs_strlib="$Id: strlib.c,v 1.36 1997/03/17 17:01:10 roberto Exp roberto $"; |
| 7 | 7 | ||
| 8 | #include <string.h> | 8 | #include <string.h> |
| 9 | #include <stdio.h> | 9 | #include <stdio.h> |
| @@ -11,6 +11,7 @@ char *rcs_strlib="$Id: strlib.c,v 1.35 1997/02/21 15:21:34 roberto Exp roberto $ | |||
| 11 | #include <ctype.h> | 11 | #include <ctype.h> |
| 12 | 12 | ||
| 13 | #include "lua.h" | 13 | #include "lua.h" |
| 14 | #include "auxlib.h" | ||
| 14 | #include "lualib.h" | 15 | #include "lualib.h" |
| 15 | 16 | ||
| 16 | 17 | ||
| @@ -518,15 +519,7 @@ static void str_format (void) | |||
| 518 | } | 519 | } |
| 519 | 520 | ||
| 520 | 521 | ||
| 521 | void luaI_openlib (struct lua_reg *l, int n) | 522 | static struct luaL_reg strlib[] = { |
| 522 | { | ||
| 523 | int i; | ||
| 524 | for (i=0; i<n; i++) | ||
| 525 | lua_register(l[i].name, l[i].func); | ||
| 526 | } | ||
| 527 | |||
| 528 | |||
| 529 | static struct lua_reg strlib[] = { | ||
| 530 | {"strtok", str_tok}, | 523 | {"strtok", str_tok}, |
| 531 | {"strlen", str_len}, | 524 | {"strlen", str_len}, |
| 532 | {"strsub", str_sub}, | 525 | {"strsub", str_sub}, |
| @@ -546,5 +539,5 @@ static struct lua_reg strlib[] = { | |||
| 546 | */ | 539 | */ |
| 547 | void strlib_open (void) | 540 | void strlib_open (void) |
| 548 | { | 541 | { |
| 549 | luaI_openlib(strlib, (sizeof(strlib)/sizeof(strlib[0]))); | 542 | luaL_openlib(strlib, (sizeof(strlib)/sizeof(strlib[0]))); |
| 550 | } | 543 | } |
