Live data from Hacker News

Lua 5.4.0 beta

lua-users.org

31–40 of 103 posts

Re: Lua 5.4.0 beta

#31

We use lua 5.3 on an embedded Platform for scripting and it has been a roller coaster ride. Not a fun one, unfortunately. You want luasocket? The stable one is not compatible with 5.3. Packages are sometimes outdated (for years no updates) and there is no replacement. The lua point releases have breaking changes. The source code itself is a macro hell which is hard to debug. And the code is not very readable. The doc…

> The documentation lacks for some topics of you use the c api.

I'm surprised to hear this. I'm doing a lot of Lua and I always thought the documentation is very succinct and complete. I really curious when issues you ran into.

> The thing is lua on embedded has no rival. but god did it cost me some nerves.

You might take a look at https://bellard.org/quickjs/ and https://duktape.org/. The latter seems oddly familiar if you've worked with the Lua C API.

Re: Lua 5.4.0 beta

#32

People that use lua, what do you use it for and why did you pick lua?

BNF is amazingly short and therefore language is easy to learn [1]

VM is tiny and can communicate bi-directionally with C / C++ code very easyly, makes it the ideal candidate for embedding in a larger app as a scripting language.

[1]http://lua4z.com/doc/manual/syntax.md.html

Re: Lua 5.4.0 beta

#33
post #2

Main changes - new generational mode for garbage collection - to-be-closed variables - const variables - userdata can have multiple user values - new implementation for math.random - warning system - debug information about function arguments and returns - new semantics for the integer 'for' loop - optional 'init' argument to 'string.gmatch' - new functions 'lua_resetthread' and 'coroutine.close' - coersions string-t…

>- utf8 library accepts codepoints up to 2^31

Interesting. Didn't Unicode restrict UTF-8 to allow encoding only 21 bits? Does it mean that it can now do 6 byte UTF-8 encodings? What kind of restrictions did it have before?

Re: Lua 5.4.0 beta

#34

People that use lua, what do you use it for and why did you pick lua?

Pretty much only for modding software/games that provide a lua API. If I were to create a software like that I would definitely consider implementing a scripting interface with LUA.

Re: Lua 5.4.0 beta

#35

People that use lua, what do you use it for and why did you pick lua?

I use it as a scripting language for my game engine, but also for all the tooling around it. Premake for generating the VS solution/makefiles, but also my own tools using IUPLua [1] and a few other modules (lfs, sqlite etc). Pretty much my whole ecosystem is C++/Lua.

[1] - https://www.tecgraf.puc-rio.br/iup/en/iuplua.html

Re: Lua 5.4.0 beta

#36
post #28
post #8

Earlier quoted context omitted.

I use FFI and LuaJIT is significantly faster on my embedded platform. Also, you can yield in coroutines in places where you can not with the standard Lua VM, such as across pcall, xpcall, iterators, and in metamethods. It is fantastic software.

I think Lua 5.3 can yield at those places as well now.

They have function variants which can do this, but you need to call lua_pcallk instead of lua_pcall, which doesn't help me much with third party libraries.

Re: Lua 5.4.0 beta

#37

We use lua 5.3 on an embedded Platform for scripting and it has been a roller coaster ride. Not a fun one, unfortunately. You want luasocket? The stable one is not compatible with 5.3. Packages are sometimes outdated (for years no updates) and there is no replacement. The lua point releases have breaking changes. The source code itself is a macro hell which is hard to debug. And the code is not very readable. The doc…

> The documentation lacks for some topics of you use the c api. I'm surprised to hear this. I'm doing a lot of Lua and I always thought the documentation is very succinct and complete. I really curious when issues you ran into. > The thing is lua on embedded has no rival. but god did it cost me some nerves. You might take a look at https://bellard.org/quickjs/ and https://duktape.org/ . The latter seems oddly familia…

My info might be a bit out of date, but something that surprised me when I looked into it was how little control I had over the embedded lua interpreter from my outer app. I basically had to hand it control by calling lua_pcall, and either wait for a result or manage a timeout from another thread.

I expected to be able to do things like tell Lua to run for X milliseconds or Y opcodes or whatever, but it didn't seem that anything like this existed.

So perhaps my disappointment with the documentation was really just disappointment that the implementation wasn't set up to do what I wanted in the way I wanted to do it. But in the course of coming to this realization, I also found the documentation frustrating and opaque.

Re: Lua 5.4.0 beta

#39
post #7

Earlier quoted context omitted.

why?

The performance difference is pretty stunning. https://luajit.org/performance_x86.html

That is comparing with 5.1.5, not 5.3 or 5.4 beta. (The default of comparing x86-32 also does not make sense to me, YMMV.)

Re: Lua 5.4.0 beta

#40
post #7

Earlier quoted context omitted.

why?

The performance difference is pretty stunning. https://luajit.org/performance_x86.html

Indeed. Mike Pall blows them out of the water single-handedly. I wonder if Lua developers have learnt anything from him with respect to performance. I would like to see how Lua 5.4.0 would perform in comparison.
Post reply on HN