-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Explicitly copy way.nodes() into vector to have proper table meta functions #3468
Conversation
fcf0337
to
6b568ed
Compare
This looks like a good workaround to let users still do what they want to. Still we break profiles here by not providing a 100% replacement with Luabind .. hrm. |
I guess to have the old behavior
but i did not find how to make working. https://github.com/Project-OSRM/osrm-backend/blob/master/third_party/sol2/sol2/sol.hpp#L11334 is how it works with sol |
Reading the issues around this, I think only supporting stateful iterators for Lua 5.2+ is fine. There is a workaround for old lua versions, and really we don't want to be slowed down by Lua 5.1 that much. @oxidase can you rebase and merge? |
6b568ed
to
980b2a5
Compare
@TheMarex rebased. But just one note - the change will not allow I simply would rely on sol2 implementation: if the lua |
@daniel-j-h @oxidase from the conversation this looks like it is ready to merge, any objections here? |
@MoKob PR makes a copy of |
As long as this check is pending, I am re-tagging this as work in progress to avoid confusion. Feel free to directly move to |
980b2a5
to
1b37df9
Compare
updated PR to wrap a Although the original issue #3452 is not completely resolved, because the returned |
1b37df9
to
4548944
Compare
4548944
to
f6fbe6a
Compare
updated PR due to windows build fail: |
Issue
For #3452 added index, length and call metafunctions to WayNodeList, so it is possible to access node references in lua as
or
The return value of
call
is a table, sofor node in way:get_nodes() do
does not work. It should be checked whatcall
should return to have an "iterable" object.EDIT: the original commit defines explicitly meta functions for
WayNodeList
. Also__pairs
and__ipairs
functions can not be explicitly defined for a usertype. Just copyingNodeRef
to vector solves the issue by using implicitlycontainer_usertype_metatable
.Tasklist