lua的table复制copy

源代码实现,来至于RESTY-HTTP

代码如下:

-- Returns a new table, recursively copied from the one given.
--
-- @param   table   table to be copied
-- @return  table
local function tbl_copy(orig)
    local orig_type = type(orig)
    local copy
    if orig_type == "table" then
        copy = {}
        for orig_key, orig_value in next, orig, nil do
            copy[tbl_copy(orig_key)] = tbl_copy(orig_value)
        end
    else -- number, string, boolean, etc
        copy = orig
    end
    return copy
end

糖果

糖果
LUA从入门到放弃

Tweyseo Walkonluajit 1

# **0. 背景**## **a. 目的**这里主要研究LuaJIT的Trace的相关原理,并且展示如何使用LuaJIT提供的[v.lua](https://github.com/LuaJIT/LuaJIT/blob/master/src/jit/v.lua)和[dump...… Continue reading

Nginx+Lua中文WIKI

Published on March 14, 2019