Permalink
Browse files

* Added cli_warn to all Lua bits.

  • Loading branch information...
1 parent 2f8ff61 commit e5f6b3e5ef3bf36fbefa4408c2f036d013fb80ce @bobbens committed Aug 21, 2012
Showing with 4 additions and 4 deletions.
  1. +2 −4 src/console.c
  2. +1 −0 src/nlua.c
  3. +1 −0 src/nlua_cli.h
View
6 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;
}
View
1 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);
View
1 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 );

0 comments on commit e5f6b3e

Please sign in to comment.