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

Macro: length as param name not allowed #4

Open
andreasplesch opened this issue Aug 30, 2016 · 2 comments
Open

Macro: length as param name not allowed #4

andreasplesch opened this issue Aug 30, 2016 · 2 comments

Comments

@andreasplesch
Copy link

While making a new arrow macro, I wanted to use 'length' as param name for the length of the desired arrow:
http://andreasplesch.github.io/x3dv4/test/Macro.html
However, this did not work, and I need to work around with the name 'lengthness'. The reason is that length is a reserved word for array indices, see below.
There is an easy solution. Just make params an object instead of an array, in line 267:
var params = {} ;
I did not test but this may be the only change necessary.

-- arrays vs. objects

aa = [1, 2];
Array [ 1, 2 ]
aa.length
2
aa['length']
2
bb = {};
Object { }
bb['i1']=12
12
bb['i2']=13
13
bb['length']
undefined

@DRx3D
Copy link
Owner

DRx3D commented Sep 2, 2016

Andreas,

Hmm, that would be bad. I will add this to the fixes. It doesn't look
like it impacts anything external so the work should go easily.

Leonard Daly

While making a new arrow macro, I wanted to use 'length' as param name
for the length of the desired arrow:
http://andreasplesch.github.io/x3dv4/test/Macro.html
However, this did not work, and I need to work around with the name
'lengthness'. The reason is that length is a reserved word for array
indices, see below.
There is an easy solution. Just make params an object instead of an
array, in line 267:
var params = {} ;
I did not test but this may be the only change necessary.

-- arrays vs. objects

aa = [1, 2];
Array [ 1, 2 ]
aa.length
2
aa['length']
2
bb = {};
Object { }
bb['i1']=12
12
bb['i2']=13
13
bb['length']
undefined


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#4, or mute the thread
https://github.com/notifications/unsubscribe-auth/AH4P5w0CRKUuy-Zy-cR0RLjkZei-rQWdks5qlC3dgaJpZM4JwhCh.

Leonard Daly
3D Systems & Cloud Consultant
X3D Co-Chair on Sabbatical
LA ACM SIGGRAPH Chair
President, Daly Realism - /Creating the Future/

@andreasplesch
Copy link
Author

Yes, it should be straightforward.

On Sep 2, 2016 12:24 AM, "DrX3D" [email protected] wrote:

Andreas,

Hmm, that would be bad. I will add this to the fixes. It doesn't look
like it impacts anything external so the work should go easily.

Leonard Daly

While making a new arrow macro, I wanted to use 'length' as param name
for the length of the desired arrow:
http://andreasplesch.github.io/x3dv4/test/Macro.html
However, this did not work, and I need to work around with the name
'lengthness'. The reason is that length is a reserved word for array
indices, see below.
There is an easy solution. Just make params an object instead of an
array, in line 267:
var params = {} ;
I did not test but this may be the only change necessary.

-- arrays vs. objects

aa = [1, 2];
Array [ 1, 2 ]
aa.length
2
aa['length']
2
bb = {};
Object { }
bb['i1']=12
12
bb['i2']=13
13
bb['length']
undefined


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#4, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AH4P5w0CRKUuy-Zy-
cR0RLjkZei-rQWdks5qlC3dgaJpZM4JwhCh>.

Leonard Daly
3D Systems & Cloud Consultant
X3D Co-Chair on Sabbatical
LA ACM SIGGRAPH Chair
President, Daly Realism - /Creating the Future/


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#4 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/AF4p62nqihB2zyVJbBzn-b38HNzawBDSks5ql6T6gaJpZM4JwhCh
.

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

2 participants