From 2c1e673fa2e361c73858709c7a06396c6df470ef Mon Sep 17 00:00:00 2001 From: Hadriel Kaplan Date: Thu, 27 Mar 2014 16:35:48 -0400 Subject: Allow chained calls with Lua TreeItem functions, and fix a couple of minor errors. A common Lua idiom is to use chained calls, i.e. tree:foo():bar():choo(). This actually works for tree:add() because it returns the new child tree item which is then the one being applied to the next chained call. But it doesn't work beyond that for things like set_generated() and so on. So this commit fixes that. This also fixes the Lua tree:add() function for the FT_BOOL type to let it be a Lua boolean value. And it reverts a previous change to Struct.tohex() to allow coercion of the argument. Change-Id: I10f819d363163914ba320c87d4bedebe5b50cacf Reviewed-on: https://code.wireshark.org/review/851 Reviewed-by: Anders Broman --- epan/wslua/wslua_proto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'epan/wslua/wslua_proto.c') diff --git a/epan/wslua/wslua_proto.c b/epan/wslua/wslua_proto.c index 5ef77cddf2..0cb67e01e0 100644 --- a/epan/wslua/wslua_proto.c +++ b/epan/wslua/wslua_proto.c @@ -126,7 +126,7 @@ static int new_pref(lua_State* L, pref_type_t type) { switch(type) { case PREF_BOOL: { - gboolean def = lua_toboolean(L,2); + gboolean def = wslua_toboolean(L,2); pref->value.b = def; break; } @@ -143,7 +143,7 @@ static int new_pref(lua_State* L, pref_type_t type) { case PREF_ENUM: { guint32 def = wslua_optgint32(L,2,0); enum_val_t *enum_val = get_enum(L,4); - gboolean radio = lua_toboolean(L,5); + gboolean radio = wslua_toboolean(L,5); pref->value.e = def; pref->info.enum_info.enumvals = enum_val; pref->info.enum_info.radio_buttons = radio; -- cgit v1.2.1