[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: JavaScript to Lua compiler
- From: Chetan Singh <chetan_dhillon@...>
- Date: Thu, 2 Oct 2008 11:18:28 -0700 (PDT)
I was referring to folloging thread on this mailing list when I said Fusion.
http://lua-users.org/lists/lua-l/2005-11/msg00266.html
At that time the work on compiling JavaScript to Lua was in progress but I could not find any update since then so I was wondering if any one knows about it and have used it.
thanks
--- On Thu, 10/2/08, David Given <dg@cowlark.com> wrote:
> From: David Given <dg@cowlark.com>
> Subject: Re: JavaScript to Lua compiler
> To: "Lua list" <lua@bazar2.conectiva.com.br>
> Date: Thursday, October 2, 2008, 7:02 AM
> steve donovan wrote:
> [...]
> > But how to tell when something's being called as a
> method? Lua
> > requires us to know this upfront so we can say
> ':' and ensure that the
> > self argument is passed implicitly.
>
> >From my limited knowledge of Javascript, you can tell
> from the syntax.
> The three types of calls are:
>
> Func()
> object.Func()
> new Func()
>
> ...which are very roughly equivalent to the Lua:
>
> Func(this)
> Func(object)
> o={}; Func(o); return o
>
> (this in Javascript is passed implicitly and is not a
> function argument.)
>
> But life is made more complex by the way that Javascript
> variables don't
> really work the same way that Lua ones do --- *all*
> 'var' variables end
> up in the equivalent of the local environment, I believe,
> and I'm not
> entirely sure of when new environments show up.
>
> (I'd like to find out about this stuff at some point,
> but the Javascript
> reference documentation is largely incomprehensible. Anyone
> know where I
> can find a clear description of how it all works?)
>
> --
> David Given
> dg@cowlark.com