lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi, is there any way to generate line mappings? It would be really useful for debugging purposes. 

Thx,
Andrei

On Tue, May 31, 2016 at 11:19 AM, Javier Guerra Giraldez <javier@guerrag.com> wrote:
On 31 May 2016 at 05:42, Justin Donaldson <jdonaldson@gmail.com> wrote:
> it needs to track its length in order to accommodate nil values


The usual approach to store nil values in a table is to use your own
'pseudo nil' value.

------
local mynil = {}

function set(t,k,v)
    if v == nil then v = mynil end
    t[k] = v
end

function get(t,k)
    local v = t[k]
    if v == mynil then v = nil end
    return v
end
-------



--
Javier