Zum Inhalt springen

Modul:URLutil: Unterschied zwischen den Versionen

whitespace damage.
w>Dcoetzee
(Oops didn't mean to do that)
w>קיפודנחש
(whitespace damage.)
Zeile 29: Zeile 29:
     local function legal( n ) return ( tonumber( n ) or 256 ) < 256  end-- in lua 0 is true!
     local function legal( n ) return ( tonumber( n ) or 256 ) < 256  end-- in lua 0 is true!
      
      
if type( s ) ~= "string" then return false end
    if type( s ) ~= "string" then return false end
     local p1, p2, p3, p4 = s:match( "^(%d+)%.(%d+)%.(%d+)%.(%d+)$" )  
     local p1, p2, p3, p4 = s:match( "^(%d+)%.(%d+)%.(%d+)%.(%d+)$" )  
     return legal( p1 ) and legal( p2 ) and legal( p3 ) and legal( p4 )
     return legal( p1 ) and legal( p2 ) and legal( p3 ) and legal( p4 )
Anonymer Benutzer