Firefox support for Lua?

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Firefox support for Lua?

Paul E. Merrell, J.D.
On the Where Lua Is Used page, I've got some language I borrowed from somewhere:

"What do Adobe Photoshop Lightroom, Angry Birds, Apache HTTP Server,
Apache Traffic Server, the Firefox web browser, MediaWiki, and World
of Warcraft all have in common? They are all extensible using the
cross-platform Lua programming language ..."
<https://sites.google.com/site/marbux/home/where-lua-is-used>.

My current question is about the Firefox support. Is there anything
more recent than Moonshine? It's last code commitment was in 2015.
<https://github.com/stpettersens/mshine>

Best regards,

Paul (who is doing some work on the Where Lua Is Used page again, finally.)
--
[Notice not included in the above original message:  The U.S. National
Security Agency neither confirms nor denies that it intercepted this
message.]
                                                ¯\_(ツ)_/¯
Reply | Threaded
Open this post in threaded view
|

Re: Firefox support for Lua?

Alek Paunov
On 2020-07-18 02:59, Paul Merrell wrote:
>
> My current question is about the Firefox support. Is there anything
> more recent than Moonshine? It's last code commitment was in 2015.
> <https://github.com/stpettersens/mshine>
>

Sure - https://fengari.io . It is a long time, supported effort by some
core Lua community members. You can also take a look to the introductory
article [1], about the differences with other Lua in Browser
implementations.

[1] https://hackernoon.com/why-we-rewrote-lua-in-js-a66529a8278d

BTW, I have another very important project for your list: syslinux - the
most universal and human friendly :-) Linux bootloader which supports:
PXE, EFI, BIOS, ISO and DOS/Windows [2]:

[2]
https://git.kernel.org/pub/scm/boot/syslinux/syslinux.git/tree/com32/lua/test/automenu.lua?id=HEAD

Kind Regards,
Alek

P.S. Paul, when you have hour or two, take a look at Dolt [3] - OSS
versioned (git-like), MySQL compatible [4] Database engine, and their
github-like hosted instance [5].

Since Lua quietly pop-ups everywhere :-), maybe it's worth it to
transform your already long list to a queryable versioned DB, where you
could merge PRs from the community. Eventually, it could become sub-app
of luarocks.org based on such datasource?

[3] https://github.com/liquidata-inc/dolt/releases
[4] https://www.dolthub.com/docs/tutorials/reading-from-dolt/#sql
[5] https://www.dolthub.com/repositories/Liquidata/ip-to-country
Reply | Threaded
Open this post in threaded view
|

Re: Firefox support for Lua?

Paul E. Merrell, J.D.


On Sat, Jul 18, 2020 at 8:21 AM Alek Paunov <[hidden email]> wrote:
Sure - https://fengari.io . It is a long time, supported effort by some
core Lua community members. You can also take a look to the introductory
article [1], about the differences with other Lua in Browser
implementations.

[1] https://hackernoon.com/why-we-rewrote-lua-in-js-a66529a8278d

Thank you very much. It's embarrassing to make a claim (Firefox support) and have it undocumented for several years!
 
BTW, I have another very important project for your list: syslinux - the
most universal and human friendly :-) Linux bootloader which supports:
PXE, EFI, BIOS, ISO and DOS/Windows [2]:

[2]
https://git.kernel.org/pub/scm/boot/syslinux/syslinux.git/tree/com32/lua/test/automenu.lua?id=HEAD

Added to the queue
.
 P.S. Eventually, it could become sub-app
of luarocks.org based on such datasource?

The fit isn't great between my page and luarocks.org. My page is for apps; luarocks is for libraries. But the ability of the community to submit content for the page would be great. I'll look at Dolt. 

Best regards,

Paul 
--
[Notice not included in the above original message:  The U.S. National Security Agency neither confirms nor denies that it intercepted this message.]
                                                ¯\_(ツ)_/¯
Reply | Threaded
Open this post in threaded view
|

Re: Firefox support for Lua?

Paul E. Merrell, J.D.
BTW, Alek, I couldn't find on your syslinux site any description of what syslinux is and does. In the process of developing my page, I've discovered that developers often neglect to include this information on their website. You'll lose a lot of site visitors' attention if you force them to read files to find out what your program does. Including the information should also help you get more site visits via search engine traffic. 

Best regards,

Paul


-- 
[Notice not included in the above original message:  The U.S. National Security Agency neither confirms nor denies that it intercepted this message.]
                                                ¯\_(ツ)_/¯
Reply | Threaded
Open this post in threaded view
|

Macro expansion of lua_newuserdata()?

Paul Ducklin
In reply to this post by Paul E. Merrell, J.D.
Forgive my ignorance if this should be obvious, but why is the API macro...

   lua_newuserdata(L,size)

...expanded into...

   lua_newuserdatauv(L,size,1)

...and not into...

   lua_newuserdatauv(L,size,0)

?

(Userdata “user values” are a new thing in 5.4.)

The Lua sources themselves never use the macro form, always calling lua_newuserdatauv() explicitly instead. And in every such call, the last parameter (number of user values) is always explicitly set to zero, as though zero is the preferred choice for vanilla userdata allocations.

From a glance at the source code I would guess it has something weird to do with garbage collection... but if so, what? And why? What’s with allocating that 1 “user value” slot for userdatas that never use it?







Reply | Threaded
Open this post in threaded view
|

Re: Firefox support for Lua?

Alek Paunov
In reply to this post by Paul E. Merrell, J.D.
On 2020-07-19 02:46, Paul Merrell wrote:
> BTW, Alek, I couldn't find on your syslinux site any description of what
> syslinux is and does.

Sorry, perhaps more appropriate for the list is the Lua module page in
the syslinux wiki:

https://wiki.syslinux.org/wiki/index.php?title=Lua.c32

It is not exactly up to date (currently, the bundled Lua is 5.2, not 5.1
as in initial Lua module merge in 2010). I am just ordinary syslinux
user, but I have a bullet in my TODO/Sonar list for syslinux BLS [1]
compatibility in Lua. After that, we will have an occasion to refresh
the page.

The original author - hpa [2] is more than well known for its
significant work. Lua module has been started by Alexey Zaytsev in 2008,
gradually improved by number of syslinux contributors and finished in
its current pleasing shape by Ferenc Wágner in 2014.

Almost every sysadmin knows the project, because at least 90% of network
boot setups are pxelinux (subproject of syslinux). The sad thing is,
that the majority just blindly copy/paste netboot configurations and is
ignorant about the Lua feature and EFI support.

Kind Regards,
Alek

[1] https://freedesktop.org/wiki/Specifications/BootLoaderSpec/
[2] https://en.wikipedia.org/wiki/Hans_Peter_Anvin
Reply | Threaded
Open this post in threaded view
|

Re: Macro expansion of lua_newuserdata()?

Joseph C. Sible
In reply to this post by Paul Ducklin
On Sun, Jul 19, 2020 at 9:48 PM Paul Ducklin <[hidden email]> wrote:

>
> Forgive my ignorance if this should be obvious, but why is the API macro...
>
>    lua_newuserdata(L,size)
>
> ...expanded into...
>
>    lua_newuserdatauv(L,size,1)
>
> ...and not into...
>
>    lua_newuserdatauv(L,size,0)
>
> ?
>
> (Userdata “user values” are a new thing in 5.4.)
>
> The Lua sources themselves never use the macro form, always calling lua_newuserdatauv() explicitly instead. And in every such call, the last parameter (number of user values) is always explicitly set to zero, as though zero is the preferred choice for vanilla userdata allocations.
>
> From a glance at the source code I would guess it has something weird to do with garbage collection... but if so, what? And why? What’s with allocating that 1 “user value” slot for userdatas that never use it?
>

User values are not new to 5.4. They have existed since 5.2. The
change in 5.4 is that each userdata can now have an arbitrary number
of them instead of having to have exactly one of them. The reason that
lua_newuserdata uses 1 instead of 0 is to avoid breaking backwards
compatibility with old code that assumed there would be one of them.
You should use lua_newuserdatauv with 0 in your own code if it doesn't
actually need the user value.

Joseph C. Sible
Reply | Threaded
Open this post in threaded view
|

Re: Macro expansion of lua_newuserdata()?

Paul Ducklin
Ah, it ought to have been obvious, thanks!

I’ve never used a “user value” so I didn’t realise they were there all along and that there was always 1 of them until now...


> On 20 Jul 2020, at 02:54, Joseph C. Sible <[hidden email]> wrote:
>
>> On Sun, Jul 19, 2020 at 9:48 PM Paul Ducklin <[hidden email]> wrote:
>>
>> Forgive my ignorance if this should be obvious, but why is the API macro...
>>
>>   lua_newuserdata(L,size)
>>
>> ...expanded into...
>>
>>   lua_newuserdatauv(L,size,1)
>>
>> ...and not into...
>>
>>   lua_newuserdatauv(L,size,0)
>>
>> ?
>>
>> (Userdata “user values” are a new thing in 5.4.)
>>
>> The Lua sources themselves never use the macro form, always calling lua_newuserdatauv() explicitly instead. And in every such call, the last parameter (number of user values) is always explicitly set to zero, as though zero is the preferred choice for vanilla userdata allocations.
>>
>> From a glance at the source code I would guess it has something weird to do with garbage collection... but if so, what? And why? What’s with allocating that 1 “user value” slot for userdatas that never use it?
>>
>
> User values are not new to 5.4. They have existed since 5.2. The
> change in 5.4 is that each userdata can now have an arbitrary number
> of them instead of having to have exactly one of them. The reason that
> lua_newuserdata uses 1 instead of 0 is to avoid breaking backwards
> compatibility with old code that assumed there would be one of them.
> You should use lua_newuserdatauv with 0 in your own code if it doesn't
> actually need the user value.
>
> Joseph C. Sible
Reply | Threaded
Open this post in threaded view
|

Re: Firefox support for Lua?

Daurnimator
In reply to this post by Alek Paunov
On Sun, 19 Jul 2020 at 01:22, Alek Paunov <[hidden email]> wrote:

>
> On 2020-07-18 02:59, Paul Merrell wrote:
> >
> > My current question is about the Firefox support. Is there anything
> > more recent than Moonshine? It's last code commitment was in 2015.
> > <https://github.com/stpettersens/mshine>
> >
>
> Sure - https://fengari.io . It is a long time, supported effort by some
> core Lua community members. You can also take a look to the introductory
> article [1], about the differences with other Lua in Browser
> implementations.
>
> [1] https://hackernoon.com/why-we-rewrote-lua-in-js-a66529a8278d

There is nothing firefox specific about fengari; I don't think it
would be genuine to claim there was.
The core of fengari is porting the PUC-Rio Lua implementation to
Javascript; which can run in any javascript environment.
Reply | Threaded
Open this post in threaded view
|

Re: Macro expansion of lua_newuserdata()?

Roberto Ierusalimschy
In reply to this post by Paul Ducklin
> Ah, it ought to have been obvious, thanks!

It is explained in the manual:

  Full userdata now has an arbitrary number of associated user values.
  [...]
  For compatibility, the old names still work as macros assuming one
  single user value.  Note, however, that userdata with zero user values
  are more efficient memory-wise.

-- Roberto