Skip to content

Why is this library built around ngx.null instead of Lua's nil? #90

Closed
@danihodovic

Description

@danihodovic

I've been using the Redis library for the past few months to build an OpenResty application and I've realized that all of the empty responses from the library are wrapped around ngx.null. This make it harder to unit test smaller pieces of code in pure Lua, as standard Lua has no ngx.null value.

It could be mocked when unit testing Lua files, but feels like an ugly workaround. Another issue is that it can't be worked around (by using if not ngx.null) since it's a truthy value which is counter-intuitive.

So why does the lua-resty-redis API return ngx.null instead of using Lua's nil value?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions