lua-users home
lua-l archive

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


On Thu, Sep 29, 2016 at 2:07 AM, Soni L. <fakedme@gmail.com> wrote:

On 28/09/16 07:53 PM, Egor Skriptunoff wrote:

Only one task is remaining to solve.
Try to find 41-byte solution for Lua 5.1
My solution for the remaining task is based on some Lua feature which looks like a design bug for me.


Hmm...

This is a 42-byte one, but I cannot seem to find a smaller one:

function NVL(a,b)return(a:gsub("^$",b))end

Except for this one, but it returns an extra value:

function NVL(a,b)return a:gsub("^$",b)end

(Altho still passes the test cases)


Nice trick with gsub!
But NVL must return single value.