summaryrefslogtreecommitdiff
path: root/lauxlib.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lauxlib.c (renamed from auxlib.c)27
1 files changed, 11 insertions, 16 deletions
diff --git a/auxlib.c b/lauxlib.c
index 276fb5f1..37a6e41a 100644
--- a/auxlib.c
+++ b/lauxlib.c
@@ -1,25 +1,20 @@
1char *rcs_auxlib="$Id: auxlib.c,v 1.4 1997/04/07 14:48:53 roberto Exp roberto $"; 1/*
2** $Id: $
3** Auxiliar functions for building Lua libraries
4** See Copyright Notice in lua.h
5*/
6
2 7
3#include <stdio.h>
4#include <stdarg.h> 8#include <stdarg.h>
9#include <stdio.h>
5#include <string.h> 10#include <string.h>
6 11
12#include "lauxlib.h"
7#include "lua.h" 13#include "lua.h"
8#include "auxlib.h"
9#include "luadebug.h" 14#include "luadebug.h"
10 15
11 16
12 17
13int luaI_findstring (char *name, char *list[])
14{
15 int i;
16 for (i=0; list[i]; i++)
17 if (strcmp(list[i], name) == 0)
18 return i;
19 return -1; /* name not found */
20}
21
22
23void luaL_arg_check(int cond, int numarg, char *extramsg) 18void luaL_arg_check(int cond, int numarg, char *extramsg)
24{ 19{
25 if (!cond) { 20 if (!cond) {
@@ -28,9 +23,9 @@ void luaL_arg_check(int cond, int numarg, char *extramsg)
28 if (funcname == NULL) 23 if (funcname == NULL)
29 funcname = "???"; 24 funcname = "???";
30 if (extramsg == NULL) 25 if (extramsg == NULL)
31 luaL_verror("bad argument #%d to function `%s'", numarg, funcname); 26 luaL_verror("bad argument #%d to function `%.50s'", numarg, funcname);
32 else 27 else
33 luaL_verror("bad argument #%d to function `%s' (%s)", 28 luaL_verror("bad argument #%d to function `%.50s' (%.100s)",
34 numarg, funcname, extramsg); 29 numarg, funcname, extramsg);
35 } 30 }
36} 31}
@@ -72,7 +67,7 @@ void luaL_openlib (struct luaL_reg *l, int n)
72 67
73void luaL_verror (char *fmt, ...) 68void luaL_verror (char *fmt, ...)
74{ 69{
75 char buff[1000]; 70 char buff[500];
76 va_list argp; 71 va_list argp;
77 va_start(argp, fmt); 72 va_start(argp, fmt);
78 vsprintf(buff, fmt, argp); 73 vsprintf(buff, fmt, argp);