Skip to content

Commit

Permalink
* Added cli_warn to all Lua bits.
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbens committed Aug 21, 2012
1 parent 2f8ff61 commit e5f6b3e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/console.c
Expand Up @@ -70,7 +70,6 @@ static int cli_firstline = 1; /**< Is this the first line? */
*/ */
static int cli_script( lua_State *L ); static int cli_script( lua_State *L );
static int cli_printOnly( lua_State *L ); static int cli_printOnly( lua_State *L );
static int cli_warn( lua_State *L );
static const luaL_Reg cli_methods[] = { static const luaL_Reg cli_methods[] = {
{ "print", cli_printOnly }, { "print", cli_printOnly },
{ "script", cli_script }, { "script", cli_script },
Expand Down Expand Up @@ -136,13 +135,12 @@ static int cli_printCore( lua_State *L, int cli_only )
* *
* @luafunc warn() * @luafunc warn()
*/ */
static int cli_warn( lua_State *L ) int cli_warn( lua_State *L )
{ {
const char *msg; const char *msg;


msg = luaL_checkstring(L,1); msg = luaL_checkstring(L,1);
fprintf(stderr, "%s\n", msg); logprintf( stderr, "Warning: %s\n", msg );
LOG("\er%s\e0", msg);


return 0; return 0;
} }
Expand Down
1 change: 1 addition & 0 deletions src/nlua.c
Expand Up @@ -112,6 +112,7 @@ int nlua_loadBasic( lua_State* L )


/* Override print to print in the console. */ /* Override print to print in the console. */
lua_register(L, "print", cli_print); lua_register(L, "print", cli_print);
lua_register(L, "warn", cli_warn);


/* add our own */ /* add our own */
lua_register(L, "include", nlua_packfileLoader); lua_register(L, "include", nlua_packfileLoader);
Expand Down
1 change: 1 addition & 0 deletions src/nlua_cli.h
Expand Up @@ -11,6 +11,7 @@




int nlua_loadCLI( lua_State *L ); /* always write only */ int nlua_loadCLI( lua_State *L ); /* always write only */
int cli_warn( lua_State *L );
int cli_print( lua_State *L ); int cli_print( lua_State *L );




Expand Down

0 comments on commit e5f6b3e

Please sign in to comment.