Browse Source

error function for Lua

Roberto Ierusalimschy 31 years ago
parent
commit
65f28f0824
2 changed files with 11 additions and 2 deletions
  1. 9 1
      inout.c
  2. 2 1
      inout.h

+ 9 - 1
inout.c

@@ -5,7 +5,7 @@
 ** Also provides some predefined lua functions.
 */
 
-char *rcs_inout="$Id: inout.c,v 2.7 1994/11/03 22:34:29 roberto Exp roberto $";
+char *rcs_inout="$Id: inout.c,v 2.8 1994/11/07 16:34:44 roberto Exp roberto $";
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -264,3 +264,11 @@ void lua_obj2number (void)
     lua_pushnil();
 }
 
+
+void luaI_error (void)
+{
+  char *s = lua_getstring(lua_getparam(1));
+  if (s == NULL) s = "(no message)";
+  lua_error(s);
+}
+

+ 2 - 1
inout.h

@@ -1,5 +1,5 @@
 /*
-** $Id: inout.h,v 1.3 1994/11/02 20:29:39 roberto Exp roberto $
+** $Id: inout.h,v 1.4 1994/11/03 22:34:29 roberto Exp roberto $
 */
 
 
@@ -23,5 +23,6 @@ void    lua_internaldostring (void);
 void    lua_print      (void);
 void    luaI_type       (void);
 void    lua_obj2number (void);
+void	luaI_error     (void);
 
 #endif