title: Comparing function to number in lua
body: <pre><code>    start = io.read()
      if start == &quot;start&quot; then
      xpr = 50
      xp = 75
      function level()
          if xp &gt;= xpr and level &lt; 50 then
              xpr = xpr * 1.5
              level = level + 1
              io.write(&quot;Congrats you somehow didn't die and lose every bit of progress!&quot;, &quot;\n&quot;)
              io.write(&quot;By the way your level is &quot;, level, &quot;\n&quot;)
              io.write(&quot;Now you must allocate your skill points now&quot;, &quot;\n&quot;)
              sp = 6
              io.write(&quot;Strength: &quot;, &quot;\n&quot;)
              strsp = io.read()
              stre = stre + strsp
              if strsp &lt; sp then
                  io.write(&quot;There are only&quot;,sp,&quot;skill points&quot;, &quot;\n&quot;)
                  str = str + 6
              end
              io.write(&quot;Dexterity: &quot;, &quot;\n&quot;)
              dexsp = io.read()
              dex = dex + dexsp
              if dexsp &lt; sp then
                  io.write(&quot;There are only&quot;,sp,&quot;skill points&quot;, &quot;\n&quot;)
                  dex = dex + 6
              end
              io.write(&quot;Constuion: &quot;, &quot;\n&quot;)
              consp = io.read()
              con = con + consp
              if consp &lt; sp then
                  io.write(&quot;There are only&quot;,sp,&quot;skill points&quot;, &quot;\n&quot;)
                  con = con + 6
              end
              io.write(&quot;Intelligence: &quot;, &quot;\n&quot;)
              intsp = io.read()
              int = int + intsp
              if intsp &lt; sp then
                  io.write(&quot;There are only&quot;,sp,&quot;skill points&quot;, &quot;\n&quot;)
                  int = int + 6
              end
              io.write(&quot;Wisdom: &quot;, &quot;\n&quot;)
              wissp = io.read()
              wis = wis + wissp
              if wissp &lt; sp then
                  io.write(&quot;There are only&quot;,sp,&quot;skill points&quot;, &quot;\n&quot;)
                  wis = wis + 6
              end
              io.write(&quot;Charisma: &quot;, &quot;\n&quot;)
              chasp = io.read()
              cha = cha + chasp
              if chasp &lt; sp then
                  io.write(&quot;There are only&quot;,sp,&quot;skill points&quot;, &quot;\n&quot;)
                  cha = cha + 6
              end
          end
      end
   end
   
  print(level(xp))
  </code></pre>
  <p>This is my code. But it comes back as</p>
  <blockquote>
  <p>lua: attempt to compare function with number</p>
  </blockquote>
  <p>How can I fix this?</p>