lua.c
changeset 132 2827e775d5fa
parent 128 8692a6fbe415
child 134 d7ab555b9766
equal deleted inserted replaced
131:d1d2754bbdaf 132:2827e775d5fa
   244 	lua_pushinteger (L, MCABBER_API_MIN);
   244 	lua_pushinteger (L, MCABBER_API_MIN);
   245 	lua_setfield (L, -2, "build_api_min");
   245 	lua_setfield (L, -2, "build_api_min");
   246 	return 1;
   246 	return 1;
   247 }
   247 }
   248 
   248 
   249 /// log print type
   249 /// log message type
   250 /// G:
   250 /// G:
   251 static const string2enum_t lua_lprint[] = {
   251 static const string2enum_t lua_lprint[] = {
   252 	{ "normal",  LPRINT_NORMAL  },
   252 	{ "normal",  LPRINT_NORMAL  },
   253 	{ "log",     LPRINT_LOG     },
   253 	{ "log",     LPRINT_LOG     },
   254 	{ "debug",   LPRINT_DEBUG   },
   254 	{ "debug",   LPRINT_DEBUG   },
   255 	{ "notutf0", LPRINT_NOTUTF8 },
   255 	{ "notutf8", LPRINT_NOTUTF8 },
   256 	{ NULL,      0              },
   256 	{ NULL,      0              },
   257 };
   257 };
   258 
   258 
   259 /// roster type
   259 /// roster type
   260 /// G:
   260 /// G:
   268 };
   268 };
   269 
   269 
   270 /// main.log
   270 /// main.log
   271 /// Prints message to log.
   271 /// Prints message to log.
   272 /// Note: most likely you need notutf8 flag enabled.
   272 /// Note: most likely you need notutf8 flag enabled.
   273 /// A: log print type, message, message...
   273 /// A: log message type, message, message...
   274 static int lua_main_log (lua_State *L)
   274 static int lua_main_log (lua_State *L)
   275 {
   275 {
   276 	int type = luaL_checkenum_multi (L, 1, lua_lprint);
   276 	int type = luaL_checkenum_multi (L, 1, lua_lprint);
   277 	lua_concat (L, lua_gettop (L) - 1);
   277 	lua_concat (L, lua_gettop (L) - 1);
   278 	scr_log_print (type, lua_tostring (L, -1));
   278 	scr_log_print (type, lua_tostring (L, -1));