Mudlet Scripting

1121314151618»

Comments

  • AnetteAnette Member Posts: 695 ✭✭✭
    edited July 5
    Don't really feel like belabouring the point since people might be on a non-current mudlet.  So for those who aren't:
    function toboolean(value)
       if (value==true) then
          -- why are you feeding bools to something named toboolean?
          return true
       elseif (value==false) then
          -- why are you feeding bools to something named toboolean?
          return false
       elseif (tonumber(value)~=nil) then
          if (tonumber(value)>0) then
             return true
          else
             return false
          end
       else
          return false
       end
    end
    

    It was a bit confusing to me we have tostring and tonumber but not toboolean.  It would have been one of the first things I'd've added with booleans when they added a boolean type.

    [edit]: Pet peeve: WSIWYG editors that ... aren't at all what you see is what you get.

    image
Sign In or Register to comment.