title: lua misinterpreying check condition
body: <p>I have a program which checks for conditions some variable field, like  </p>
  
  <pre><code>if(tostring(field) == '0') then {do something}
  if(tostring(field) == '1') then {do something}  
  if(tostring(field) == '2') then {do something}  
  </code></pre>
  
  <p>But, i think lua is interpreting '0' and '1' as TRUE/FALSE values and not checking the corresponding if conditions properly. The condition executes properly for field == '2' condition.<br>
  How can i overcome this case? How can i make it work for check conditions '0' and '1'?<br>
  Thank You in advance!<br>
  In case you are wondering why i tagged wireshark, the if check condition is checking for a field in pcap file.<br>
  My lua code for reference is as follows:  </p>
  
  <pre><code>#!/usr/bin/lua
  
  do
      local pkts = 0
      local stat = {}
      local file = io.open("luawrite","w")
      local function init_listener()
              local tap = Listener.new("wlan")
              local src_addr = Field.new("wlan.sa")
              local type = Field.new("wlan.fc.type")
              local sub_type = Field.new("wlan.fc.subtype")
              local frame_length = Field.new("frame.len")
              local data_rate = Field.new("wlan.data_rate")
              function tap.reset()
                      pkts = 0;
              end
  
              function tap.packet(pinfo, tvb)
                      local client = src_addr()
                      local stype = sub_type()
                      local ty = type()
                      local ts = tostring(pinfo.rel_ts)
                      local fl = frame_length()
                      rate = data_rate()
                      if(tostring(ty) == '0')  then
                              file:write(tostring(ts), "\t", tostring(fl), "\t", tostring(rate), "\n")
                      end
              end
      end
      init_listener()
  end  
  </code></pre>
  
  <p>The condition i am referring to 7th line from last line. If i give the condition tostring(ty) == '2', it works properly.  </p>