From Marton Nemeth <nm127@freemail.hu>

correct example and documentation about register_menu()

my own: do not fail to make init.lua when building in a different dir



svn path=/trunk/; revision=24879
This commit is contained in:
Luis Ontanon 2008-04-10 20:07:58 +00:00
parent d4b67e68f4
commit db608bdf76
4 changed files with 10 additions and 9 deletions

View File

@ -154,7 +154,7 @@ do
-- using this function we register our fuction
-- to be called when the user selects the Tools->Test->Packets menu
register_menu("Test/Packets",menuable_tap)
register_menu("Test/Packets", menuable_tap, MENU_TOOLS)
end
</programlisting>
</section>

View File

@ -108,4 +108,4 @@ dummy:
touch dummy
init.lua: template-init.lua make-init-lua.pl ../ftypes/ftypes.h ../../wiretap/wtap.h ../proto.h ../../stat_menu.h
$(PERL) $(srcdir)/make-init-lua.pl template-init.lua > init.lua
$(PERL) $(srcdir) $(srcdir)/make-init-lua.pl template-init.lua > init.lua

View File

@ -28,7 +28,8 @@
use strict;
my $WSROOT = "../..";
my $root = shift;
my $WSROOT = $root . "/../..";
my $wtap_encaps_table = '';
my $ft_types_table = '';

View File

@ -71,18 +71,18 @@ void lua_menu_callback(gpointer data) {
return;
}
WSLUA_FUNCTION wslua_register_menu(lua_State* L) { /* Register a menu item in the Statistics menu. */
#define WSLUA_ARG_register_menu_NAME 1 /* The name of the menu item. */
#define WSLUA_ARG_register_menu_ACTION 2 /* The function to be called when the menu item is invoked. */
#define WSLUA_ARG_register_menu_GROUP 3 /* The menu group into which the menu item is to be inserted. */
WSLUA_FUNCTION wslua_register_menu(lua_State* L) { /* Register a menu item in one of the main menus. */
#define WSLUA_ARG_register_menu_NAME 1 /* The name of the menu item. The submenus are to be separated by '/'s. (string) */
#define WSLUA_ARG_register_menu_ACTION 2 /* The function to be called when the menu item is invoked. (function taking no arguments and returning nothing) */
#define WSLUA_OPTARG_register_menu_GROUP 3 /* The menu group into which the menu item is to be inserted. One of MENU_STAT (Statistics), MENU_STAT_GENERIC (Statistics, first section), MENU_STAT_CONVERSATION (Statistics/Conversation List), MENU_STAT_ENDPOINT (Statistics/Endpoint List), MENU_STAT_RESPONSE (Statistics/Service Response Time), MENU_STAT_TELEPHONY (Statistics, third section), MENU_ANALYZE (Analyze), MENU_ANALYZE_CONVERSATION (Analyze/Conversation Filter), MENU_TOOLS (Tools). (number) */
const gchar* name = luaL_checkstring(L,WSLUA_ARG_register_menu_NAME);
struct _lua_menu_data* md;
gboolean retap = FALSE;
register_stat_group_t group = (int)luaL_optnumber(L,WSLUA_ARG_register_menu_GROUP,REGISTER_STAT_GROUP_GENERIC);
register_stat_group_t group = (int)luaL_optnumber(L,WSLUA_OPTARG_register_menu_GROUP,REGISTER_STAT_GROUP_GENERIC);
if ( group > REGISTER_TOOLS_GROUP_NONE)
WSLUA_ARG_ERROR(register_menu,GROUP,"must be a defined MENU_* (see init.lua)");
WSLUA_OPTARG_ERROR(register_menu,GROUP,"must be a defined MENU_* (see init.lua)");
if(!name)
WSLUA_ARG_ERROR(register_menu,NAME,"must be a string");