From e5f6b3e5ef3bf36fbefa4408c2f036d013fb80ce Mon Sep 17 00:00:00 2001 From: Edgar Simo-Serra Date: Tue, 21 Aug 2012 15:45:39 +0200 Subject: [PATCH] * Added cli_warn to all Lua bits. --- src/console.c | 6 ++---- src/nlua.c | 1 + src/nlua_cli.h | 1 + 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/console.c b/src/console.c index 7cf00275cd..af91fd5bb3 100644 --- a/src/console.c +++ b/src/console.c @@ -70,7 +70,6 @@ static int cli_firstline = 1; /**< Is this the first line? */ */ static int cli_script( lua_State *L ); static int cli_printOnly( lua_State *L ); -static int cli_warn( lua_State *L ); static const luaL_Reg cli_methods[] = { { "print", cli_printOnly }, { "script", cli_script }, @@ -136,13 +135,12 @@ static int cli_printCore( lua_State *L, int cli_only ) * * @luafunc warn() */ -static int cli_warn( lua_State *L ) +int cli_warn( lua_State *L ) { const char *msg; msg = luaL_checkstring(L,1); - fprintf(stderr, "%s\n", msg); - LOG("\er%s\e0", msg); + logprintf( stderr, "Warning: %s\n", msg ); return 0; } diff --git a/src/nlua.c b/src/nlua.c index 4c8dd9afab..3c76df43a4 100644 --- a/src/nlua.c +++ b/src/nlua.c @@ -112,6 +112,7 @@ int nlua_loadBasic( lua_State* L ) /* Override print to print in the console. */ lua_register(L, "print", cli_print); + lua_register(L, "warn", cli_warn); /* add our own */ lua_register(L, "include", nlua_packfileLoader); diff --git a/src/nlua_cli.h b/src/nlua_cli.h index 14677d26cd..e27b1bf5cf 100644 --- a/src/nlua_cli.h +++ b/src/nlua_cli.h @@ -11,6 +11,7 @@ int nlua_loadCLI( lua_State *L ); /* always write only */ +int cli_warn( lua_State *L ); int cli_print( lua_State *L );