summaryrefslogtreecommitdiff
path: root/epan/wslua/wslua_proto.c
diff options
context:
space:
mode:
authorHadriel Kaplan <hadrielk@yahoo.com>2014-03-27 16:35:48 -0400
committerAnders Broman <a.broman58@gmail.com>2014-03-28 04:27:43 +0000
commit2c1e673fa2e361c73858709c7a06396c6df470ef (patch)
treeeed3464aa681e031c1c7eb7f0ae7e38633b001e4 /epan/wslua/wslua_proto.c
parent0ffc690da40edf31acb95b2a15033d43a3f35ebd (diff)
downloadwireshark-2c1e673fa2e361c73858709c7a06396c6df470ef.tar.gz
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 <a.broman58@gmail.com>
Diffstat (limited to 'epan/wslua/wslua_proto.c')
-rw-r--r--epan/wslua/wslua_proto.c4
1 files changed, 2 insertions, 2 deletions
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;