lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


It was thus said that the Great Sean Conner once stated:
> 
> 	function range(low,high)
> 	  return lpeg.Cmt(d^1,function(subject,position,capture)
> 	    local v = tostring(capture)
> 	    if v >= low and v <= high then
> 	      return position,v
> 	    end
> 	  end)
> 	end

  I'm getting tired and shouldn't be programming.  This *should* be:

	function range(low,high)
	  return lpeg.Cmt(d^1,function(subject,position,capture)
	    local v = tonumber(capture)
	    if v >= low and v <= high then
	      return position,v
	    end
	  end)
	end

  -spc (Sigh)