diff options
Diffstat (limited to 'lbuiltin.c')
-rw-r--r-- | lbuiltin.c | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lbuiltin.c,v 1.32 1998/06/29 18:24:06 roberto Exp roberto $ | 2 | ** $Id: lbuiltin.c,v 1.33 1998/07/12 16:16:43 roberto Exp roberto $ |
3 | ** Built-in functions | 3 | ** Built-in functions |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -192,6 +192,19 @@ static void luaI_print (void) { | |||
192 | } | 192 | } |
193 | 193 | ||
194 | 194 | ||
195 | static void luaB_message (void) { | ||
196 | fputs(luaL_check_string(1), stderr); | ||
197 | } | ||
198 | |||
199 | |||
200 | static void error_message (void) { | ||
201 | char buff[200]; | ||
202 | sprintf(buff, "lua error: %.180s\n", luaL_check_string(1)); | ||
203 | lua_pushstring(buff); | ||
204 | lua_call("_ALERT"); | ||
205 | } | ||
206 | |||
207 | |||
195 | static void luaI_type (void) | 208 | static void luaI_type (void) |
196 | { | 209 | { |
197 | lua_Object o = luaL_nonnullarg(1); | 210 | lua_Object o = luaL_nonnullarg(1); |
@@ -568,6 +581,7 @@ static struct luaL_reg int_funcs[] = { | |||
568 | {"copytagmethods", copytagmethods}, | 581 | {"copytagmethods", copytagmethods}, |
569 | {"dostring", internaldostring}, | 582 | {"dostring", internaldostring}, |
570 | {"error", luaI_error}, | 583 | {"error", luaI_error}, |
584 | {"_ERRORMESSAGE", error_message}, | ||
571 | {"foreach", foreach}, | 585 | {"foreach", foreach}, |
572 | {"foreachvar", foreachvar}, | 586 | {"foreachvar", foreachvar}, |
573 | {"getglobal", getglobal}, | 587 | {"getglobal", getglobal}, |
@@ -588,7 +602,8 @@ static struct luaL_reg int_funcs[] = { | |||
588 | {"tonumber", luaB_tonumber}, | 602 | {"tonumber", luaB_tonumber}, |
589 | {"tostring", to_string}, | 603 | {"tostring", to_string}, |
590 | {"tag", luatag}, | 604 | {"tag", luatag}, |
591 | {"type", luaI_type} | 605 | {"type", luaI_type}, |
606 | {"_ALERT", luaB_message} | ||
592 | }; | 607 | }; |
593 | 608 | ||
594 | 609 | ||