The var prefix makes assignment be like =. (local assignment).

If the var prefix has not yet been used in a definition you instead get
something like =: (locale assignment).

So with perfectly well written code you should not see any difference
between having the var or not. But between recursion, mistakes, and wanting
to keep argument lists and packing/unpacking issues under control,
sometimes var matters.

It sounds like you found your issue, but this bit of background info might
help.

Thanks,

-- 
Raul



On Thu, Mar 6, 2014 at 8:55 AM, Brian Schott <[email protected]> wrote:

> Here is a little more information. If, instead of
> the drawPrimitive(gl.LINES,[0,0,0,1],[0,0,0,0,0.04,0]); line I showed
> before, I enter the following line which includes the values of color and
> move, I do not get any error. Whether I include the `var` prefix to color
> and move does not seem to matter, either.
>
> Any ideas?
>
> On the other hand I do not get a line drawn either, so even if the original
> problem is fixed, I have work to do connecting the drawPrimitive() with the
> canvas or the draw() function. Or maybe the location of this code is part
> of the non-drawing problem. Normally drawPrimitive() is executed within
> draw(), not outside of draw() as it is now.
>
> But the big issue is the error message I first mentioned:
>
> `ev_command_enter_ajax(d) failed`
>
> Raul, I assume your reply was about my question about a typo, that really
> has no effect on the processing, so I guess you are correct that the semi
> colon is unnecessary.
>
> drawPrimitive(gl.LINES,[0,0,0,1],[0,0,0,0,0.04,0]);
>
>
>
> On Wed, Mar 5, 2014 at 6:14 PM, Brian Schott <[email protected]>
> wrote:
>
> > In my turtle graphics app based on Eric's jdemogl1.ijs I want to use the
> > drawPrimitive() function to draw a line. For now I am experimenting with
> > drawing directly from ev_command_enter_ajax(ts).
> >
> > My version of ev_command_enter_ajax() is below, and when I leave all 3
> > lines of code in, I get the error alert `ev_command_enter_ajax(d) failed`
> > [Btw, notice the 'd' in the parens]. I believe the values of color
> (ts[0])
> > and move (ts[1]) are correct strings created by the J code, because
> > alert(color); and alert(move); produced the expected result.
> >
> > Any ideas about how to get the drawPrimitive() to work?
> >
> > function ev_command_enter_ajax(ts)
> > {
> >  var color=ts[0];
> >  var move=ts[1];
> >  drawPrimitive(gl.LINES,color,move);
> > }
> >
> > Btw, the next 3 lines are copied from Eric's jdemogl1.ijs. Does the last
> > one contain a typo regarding the final semicolon in the last one? (If so,
> > should it be before the right curly bracket?)
> >
> > function ev_body_load(){init();} // must use JHS framework load handler
> > function ev_bgcolor_click(){jdoajax([],"");}
> > function ev_bgcolor_click_ajax(ts){bgcolor=eval(ts[0]);draw()};
> >
> > Thank you,
> >
> > --
> > (B=)
> >
>
>
>
> --
> (B=) <-----my sig
> Brian Schott
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to