Skip to content

Suggestion: add isEmpty for LuaSet and LuaMap #1466

@rhazarian

Description

@rhazarian

Its possible to check if a table is empty using the next function.

Currently I always have to do the following in my TS code when I want to test if a LuaSet/LuaMap is not empty:

if (next(luaSet)[0] != undefined) {
    ...
}

I think it would be very handy if you could abstract it into a fake isEmpty method/getter, which would transpile in the following way:

if (luaSet.isEmpty) {
    ...
}

should be equal to

if (next(luaSet)[0] == undefined) {
    ...
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions