←back to thread

218 points generichuman | 5 comments | | HN request time: 0.599s | source
1. samiv ◴[] No.44007009[source]
After having embedded Lua in my game engine and having worked with some Lua games I've come to conclusion that:

- Lua is great from the integrator/engine dev perspective. It's easy to embed and there are several libraries that help with creating bindings between Lua and your game classes.

- Lua has absolutely terrible runtime performance especially when the GC stalls. You soon learn that you have to start moving code to the native side and carefully consider the APIs that you provide for the game so that you can even dream of any type of performance. Haven't tried LuaJIT since that doesn't work with WASM so it's not an option for me.

- The loose runtime typing in Lua is absolutely terrible, and while it's easy and fast to knock up some simple script you really pay the price when you try to maintain or refactor your code and you have no typing information. For the game engine developer this also makes it very hard to provide any kind of help for the game developer, i.e. "intellisense" kind of functionality. I've basically "solved" this by assuming that variables have certain name suffixes and prefixes and when those are present I assume that it has a certain type which lets me provide a list of functions in the script editor to the game developer. Far from perfect. [see link below]

https://github.com/ensisoft/detonator/blob/master/screens/ed...

replies(4): >>44007470 #>>44007936 #>>44008519 #>>44010512 #
2. spookie ◴[] No.44007470[source]
Any alternatives you've tried that are better in those areas?
3. augusto-moura ◴[] No.44007936[source]
The lua language service [1] supports type annotations inside comments [2]. Sure, it is not the same as having types as first class citizens, but I would say that it solves 95% of the editor support and typying problems you mentioned in your 3rd point.

But yeah, PUC-Rio Lua is not fast, but it is acceptable, and maybe one of the most performant of all non-JIT dynamic languages. If you need speed, JIT is a requirement.

[1]: https://luals.github.io/

[2]: https://luals.github.io/wiki/annotations/

4. Llamamoe ◴[] No.44008519[source]
It's a shame you can't use LuaJIT. It's one of if not THE highest performance JIT out there.
5. nicce ◴[] No.44010512[source]
What is the usecase for WASM? Browser games?