Lua: return nil when function failed instead of returning nothing