webmcp

changeset 498:e360b1933c78

Improve efficiency of table.insert in case of Lua 5.3 (do not use compatibility wrapper)
author jbe
date Sun Jul 23 03:43:49 2017 +0200 (2017-07-23)
parents d89813dd4d92
children b36e366bba2b
files framework/env/__init.lua
line diff
     1.1 --- a/framework/env/__init.lua	Sun Jul 23 02:51:13 2017 +0200
     1.2 +++ b/framework/env/__init.lua	Sun Jul 23 03:43:49 2017 +0200
     1.3 @@ -64,10 +64,10 @@
     1.4  Custom implementation of Lua's table.insert(...) where table.insert(table, value) also respects metamethods in Lua 5.2 (this behavior is already supported by Lua 5.3).
     1.5  
     1.6  --]]--
     1.7 -do
     1.8 +if _VERSION == "Lua 5.2" then
     1.9    local old_insert = table.insert
    1.10    function table.insert(...)
    1.11 -    if _VERSION == "Lua 5.2" and select("#", ...) == 2 then
    1.12 +    if select("#", ...) == 2 then
    1.13        local t, value = ...
    1.14        t[#t+1] = value
    1.15        return

Impressum / About Us