Operators, indexing and named parameters from Lua#47
Merged
greatwolf merged 7 commits intobastibe:masterfrom Dec 12, 2016
Merged
Operators, indexing and named parameters from Lua#47greatwolf merged 7 commits intobastibe:masterfrom
greatwolf merged 7 commits intobastibe:masterfrom
Conversation
Implemented __mul metamethod in lua that maps to python __mul __ or __rmul __, same for lua __div, __add, __sub, __pow. Tested in nparray.
Added a test where any index or newindex request with a non-string key is mapped to a python index irrespective of the asindx status. This allows in lua e.g. a = np.arange(0, 10); print(a[0])
This change is needed to make the implementation of operators work.
If a single parameter is passed when calling a python function and that parameter is a table, then numbered elements are passed as regular arguments and named elements as named parameters. This allows, e.g., plt.plot(x, y) and plt.plot{x, y, c='red'} to coexist. The latter is a lua shortcut for passing a single table as argument. When you want to pass a single table as regular argument use func{{1, 2}} or func({1, 2}, nil)
C doesn't officially define min max. Fixed tabs.
Need at least CMake 3.0.0 for FindLua. Earlier versions only have FindLua50 and FindLua51.
Contributor
Author
|
Nice work. Thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi,
these commits would add operators on python objects from Lua (2 commits, my mistake), default non-string Lua indexing to python indexing, and allow calling a python method with named parameters. The latter change has a few indendation errors due to copy/paste from editor. The branch has been tested.