Skip to content

how to convert std::optional to sol::optional? #1725

@scarf005

Description

@scarf005

pretty certain there's easier way to do this but i can't seem to find any info on neither docs nor github issues

        std::optional<tripoint> stdOpt = choose_adjacent( message, allow_vertical.value_or( false ) );
        if( stdOpt.has_value() )
        {
            return sol::optional<tripoint>( *stdOpt );
        }
        return sol::optional<tripoint>();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions