Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

argument defaults #110

Open
tmbdev opened this issue Jan 14, 2017 · 0 comments
Open

argument defaults #110

tmbdev opened this issue Jan 14, 2017 · 0 comments

Comments

@tmbdev
Copy link

tmbdev commented Jan 14, 2017

I would find it useful if typedlua allowed defaults for arguments; this often is useful for being able to specify a more restrictive type, e.g. "string" instead of "string?"

function f(x:string="something"): string
    return x..x
end

instead of

function f(x: string?): string
    if x==nil then x = "something" end
    return x..x
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant