net.server_event: Replace usage of string.len() with # operator
authorMatthew Wild <mwild1@gmail.com>
Thu, 26 Jul 2012 15:46:18 +0000 (16:46 +0100)
committerMatthew Wild <mwild1@gmail.com>
Thu, 26 Jul 2012 15:46:18 +0000 (16:46 +0100)
net/server_event.lua

index 264d50a7e4cade6067478024513a2ed6f7aa68b1..f2626f5f4d7c5896a6e83642e4805e360ab5953d 100644 (file)
@@ -115,7 +115,6 @@ do
        
        local addevent = base.addevent
        local coroutine_wrap, coroutine_yield = coroutine.wrap,coroutine.yield
-       local string_len = string.len
        
        -- Private methods
        function interface_mt:_position(new_position)
@@ -310,7 +309,7 @@ do
                if self.nowriting then return nil, "locked" end
                --vdebug( "try to send data to client, id/data:", self.id, data )
                data = tostring( data )
-               local len = string_len( data )
+               local len = #data
                local total = len + self.writebufferlen
                if total > cfg.MAX_SEND_LENGTH then  -- check buffer length
                        local err = "send buffer exceeded"