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

Add methods to the class table of Lua bindings. #73

Open
Possseidon opened this issue Feb 22, 2022 · 0 comments
Open

Add methods to the class table of Lua bindings. #73

Possseidon opened this issue Feb 22, 2022 · 0 comments
Assignees
Labels
dang-lua enhancement New feature or request

Comments

@Possseidon
Copy link
Owner

For a functional style of programming it is very useful to have access to all the methods directly.

For example, given a table values of vec3, if one would want to sort them by length, then this:

table.sort(values, by(vec3.getLength))

is a lot nicer (and more performant) than this:

table.sort(values, by(function(vector) return vector:getLength() end))
-- or
table.sort(values, by(vec3().getLength))

(Where by returns a comparator based on the given projection function)

@Possseidon Possseidon added enhancement New feature or request dang-lua labels Feb 22, 2022
@Possseidon Possseidon self-assigned this Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dang-lua enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant