title: redis script check if hash field exists
body: <p>The question is about <em>lua script</em> in redis.</p>
  
  <p>I'm trying to check if some field exists in a hash table, but the return value of <code>redis.call</code> suprised me:</p>
  
  <pre><code>    EVAL 'local label = "oooo"; local tesid = redis.call("HGET", "nosuchkey", "nosuchfield"); if tesid == nil then label="aaaa" elseif tesid == "" then label="bbbb" else label = "kkkk" end; return {tesid,label}' 0
  </code></pre>
  
  <p>the return value is</p>
  
  <pre><code>    1) (nil)
      2) "kkkk"
  </code></pre>
  
  <p>I don't understand why I got into that <code>else</code> branch -- where <code>label</code> is set to <code>"kkkk"</code> -- when tesid is <code>nil</code>, I think it should output <code>"aaaa"</code>.</p>
  
  <p>Why does the script go into <code>"kkkk"</code> label?</p>
  
  <p>For better reading, I paste the script here:</p>
  
  <pre><code>    local label = "oooo"
      local tesid = redis.call("HGET", "nosuchkey", "nosuchfield")
      if tesid == nil
      then
          label="aaaa"
      elseif tesid == ""
      then
          label="bbbb"
      else
          label = "kkkk"
      end
      return {tesid,label}
  </code></pre>