Module talk:User:DTLHS/defs

From Wiktionary, the free dictionary
(Redirected from Module talk:defs)
Latest comment: 10 years ago by Xoristzatziki
Jump to navigation Jump to search

Faster(?) approach. Does not check in every line if this is the first line of "ret" string.

    for i,v in ipairs(lines_) do
        if string.sub(v, 1, 1) == "#" then
            ret = ret.."\n"..v
        end
    end
    --if we found anything
    if string.len(ret) > 1 then
        ret = string.sub(ret,2)
    end

--Xoristzatziki (talk) 07:35, 5 March 2014 (UTC)Reply