lua: fix reload with -Xlua_script

Use ex_opt_get_nth instead of ex_opt_get_next to avoid consuming the
parameters. This ensures that lua scripts via the "-Xlua_script"
parameter are also reloaded.

Change-Id: I316726cdf99f7ee3d738d3632a7f639ea8596f96
Reviewed-on: https://code.wireshark.org/review/14870
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
This commit is contained in:
Peter Wu 2016-04-08 23:28:45 +02:00
parent 1e287f1da7
commit 4a37458c5d
1 changed files with 6 additions and 5 deletions

View File

@ -445,11 +445,11 @@ static void wslua_clear_plugin_list(void)
static int lua_script_push_args(const int script_num) {
gchar* argname = g_strdup_printf("lua_script%d", script_num);
const gchar* argvalue = NULL;
int count = 0;
int i, count = ex_opt_count(argname);
while((argvalue = ex_opt_get_next(argname))) {
for (i = 0; i < count; i++) {
argvalue = ex_opt_get_nth(argname, i);
lua_pushstring(L,argvalue);
count++;
}
g_free(argname);
@ -719,12 +719,12 @@ wslua_get_expert_field(const int group, const int severity)
void wslua_init(register_cb cb, gpointer client_data) {
gchar* filename;
const gchar *script_filename;
const funnel_ops_t* ops = funnel_get_funnel_ops();
gboolean run_anyway = FALSE;
expert_module_t* expert_lua;
int file_count = 1;
static gboolean first_time = TRUE;
int i;
static hf_register_info hf[] = {
{ &hf_wslua_fake,
@ -928,7 +928,8 @@ void wslua_init(register_cb cb, gpointer client_data) {
g_free(filename);
/* load scripts from command line */
while((script_filename = ex_opt_get_next("lua_script"))) {
for (i = 0; i < ex_opt_count("lua_script"); i++) {
const gchar *script_filename = ex_opt_get_nth("lua_script", i);
char* dirname = g_strdup(script_filename);
char* dname = get_dirname(dirname);