lua-users home
lua-l archive

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


I have a table generated by luasoap.
function trackNum(tracknum)
    local ns, meth, ent = {
        url = "" href="http://mysite/api/service.asmx">http://mysite/api/service.asmx",
        soapaction = "",
        method = "Track",
        namespace = "",
        entries = {
                tag = "TrackNo", tracknum,
    local Code = ent[1][1][1][1] or "201"
    local Status = if ent[1][1][3][1][17][1] or "Unknown"
    return Code, Status

so, I don't know how many indexes will be in answer (btw, is it possible to address by names? for example ent['Code']) and I want to escape  error attempt to index a nil value (field '?').

What the best way to do it? something like try/except int python?

Aydar A. Kamalov