Skip to content

Forwarding luaIterator+tupleReturn doesn't work #389

@tomblind

Description

@tomblind

The following should work:

declare namespace string {
    /** @tupleReturn @luaIterator */
    export function gmatch(s: string, pattern: string): Iterable<string[]>
}

/** @tupleReturn @luaIterator */
function parse(text: string) {
    return string.gmatch(text, "%S+");
}

for (const [s] of parse("foo bar baz")) {
    print(s);
}

But won't, because the return value in parse is wrapped in a table by mistake:

parse = function(text)
    return ({string.gmatch(text, "%S+")});
end;

This should work since normal tupleReturn decorated functions will correctly forward the return 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