# HG changeset patch # User Myhailo Danylenko # Date 1270665652 -10800 # Node ID 1ed8491ae1b43120a978a1659675649feb23d86a # Parent c60fe499f0755b87f0e5842800a7c13b381a4c88 Add main.version () diff -r c60fe499f075 -r 1ed8491ae1b4 lua.c --- a/lua.c Sun Apr 04 20:55:04 2010 +0300 +++ b/lua.c Wed Apr 07 21:40:52 2010 +0300 @@ -38,6 +38,8 @@ #include // compl_new_category, compl_add_category_word, compl_del_category_word #include // evs_* #include // module_info_t +#include // mcabber_branch, mcabber_api_version +#include // mcabber_version #include "config.h" #include "util.h" @@ -60,7 +62,7 @@ static module_info_t info_lua_experimental = { .branch = "experimental", - .api = 15, + .api = 20, .version = PROJECT_VERSION, .description = DESCRIPTION, .requires = NULL, @@ -200,6 +202,31 @@ return 1; } +/// main.version +/// Returns information about mcabber version +/// R: table +static int lua_main_version (lua_State *L) +{ + lua_createtable (L, 0, 3); + lua_pushstring (L, mcabber_branch); + lua_setfield (L, -2, "branch"); + lua_pushinteger (L, mcabber_api_version); + lua_setfield (L, -2, "api"); + { + gchar *version = mcabber_version (); + lua_pushstring (L, version); + g_free (version); + } + lua_setfield (L, -2, "version"); + lua_pushliteral (L, MCABBER_BRANCH); + lua_setfield (L, -2, "build_branch"); + lua_pushinteger (L, MCABBER_API_VERSION); + lua_setfield (L, -2, "build_api"); + lua_pushinteger (L, MCABBER_API_MIN); + lua_setfield (L, -2, "build_api_min"); + return 1; +} + /// log print type /// G: static const string2enum_t lua_lprint[] = { @@ -1564,6 +1591,7 @@ #ifdef LLM_CONNECTION_ENABLE reg ( connection ) #endif + reg ( version ) reg ( log ) reg ( option ) reg ( alias )