Why do people use Lua in a world where we have Python?
Much like many people turn to Python for scientific scripting, for example, Lua has gained a reputation for being easy to use in the game development world.
21–30 of 79 posts
Why do people use Lua in a world where we have Python?
Much like many people turn to Python for scientific scripting, for example, Lua has gained a reputation for being easy to use in the game development world.
Why do people use Lua in a world where we have Python?
LuaJIT is much faster than Python, directly interfaces with C, incredibly small,and the language itself is very simple. This is also built on top of LOVE2D which is written in Lua and is arguably one of the best game frameworks out there.
Why do people use Lua in a world where we have Python?
Why do people use Lua in a world where we have Python?
Does Python have any good game engines? PyGame project is a nightmare. Lua's https://love2d.org/ is amazing.
https://pygame-zero.readthedocs.io
https://github.com/mjbrusso/game2dboard
Disclosure: I am the author of game2dboard
Thank you for posting this, Bambo! I was curious why we were seeing 10s of new stars all of a sudden and trying to figure out where the GitHubbers were coming from. Grid Engine 9 is now the largest pure-Lua game engine on GitHub. As s_y_n_t_a_x has mentioned in this thread, I built the Grid Engine on top of LÖVE. I came from the hlcoders world, having used the Source Engine for several years, and was upset the 2D wor…
Thank you for posting this, Bambo! I was curious why we were seeing 10s of new stars all of a sudden and trying to figure out where the GitHubbers were coming from. Grid Engine 9 is now the largest pure-Lua game engine on GitHub. As s_y_n_t_a_x has mentioned in this thread, I built the Grid Engine on top of LÖVE. I came from the hlcoders world, having used the Source Engine for several years, and was upset the 2D wor…
Lua is a little confusing language for me because you need to throw out most of the things you know because it has its own way of doing things, it is not necessarily a bad thing but it is confusing. Luckily, it is a very small language so it wouldn't take that long to grasp it all. The most confusing thing was the fact that (almost) everything seems like a hashtable.
The main thing you need to know is that Lua's table type can be numerically iterated between index 1 and the first gap where numeric index has nil value using the ipairs iterator in addition to the non-exclusively-numeric unordered pairs iterator. A common pitfall with sparse tables is that the length shortcut # returns seemingly the wrong result if you aren't aware of that first part.
Most of the difficulty writing in Lua comes from the fact that there's no first class support for OO-style Classes, so you have to fake them, and there's no standard library so you end up reinventing a lot.
But other than that, it's a dead simple language with few features.
Lua is a little confusing language for me because you need to throw out most of the things you know because it has its own way of doing things, it is not necessarily a bad thing but it is confusing. Luckily, it is a very small language so it wouldn't take that long to grasp it all. The most confusing thing was the fact that (almost) everything seems like a hashtable.
Ignoring metatable weirdness, I think "you need to throw out most of what you know" is quite wrong. The main thing you need to know is that Lua's table type can be numerically iterated between index 1 and the first gap where numeric index has nil value using the ipairs iterator in addition to the non-exclusively-numeric unordered pairs iterator. A common pitfall with sparse tables is that the length shortcut # return…
My pet peeve is that it's somewhat verbose in using keywords rather than single-character punctuation to mark blocks and clauses.
Lua is a little confusing language for me because you need to throw out most of the things you know because it has its own way of doing things, it is not necessarily a bad thing but it is confusing. Luckily, it is a very small language so it wouldn't take that long to grasp it all. The most confusing thing was the fact that (almost) everything seems like a hashtable.
Ignoring metatable weirdness, I think "you need to throw out most of what you know" is quite wrong. The main thing you need to know is that Lua's table type can be numerically iterated between index 1 and the first gap where numeric index has nil value using the ipairs iterator in addition to the non-exclusively-numeric unordered pairs iterator. A common pitfall with sparse tables is that the length shortcut # return…
Metatables are cool, but have some weirdness to them. For OOP i ended up using metatables to make a simple prototype(rather than class) based system, but it was hacky at best.
Tables themselves are pretty awesome and powerful, but I have to admit, working with them gets a bit tiresome in ways working with dedicated arrays and hash maps don't. You have to remember exactly what kind of data is in your tables and looping through them can be a pain.
Overall though, I still love lua, it's the language that helped me 'get' programming and I wouldn't actually appreciate dedicated data structures and typed variables so much if I hadn't had the experience of starting with a more free, loose and simple language like lua. Also, its ability to easily interface with C and be easily embedded has made it appear in so many different and sometimes strange and just downright cool applications.
I've been playing with the solarus engine lately, it uses lua for its scripting, it's the first time I've written any lua in a while, but i've been enjoying it as I rediscover all the little cool things I like about it and i still think it makes a good first or second language for people.
Having the reinvent the wheel isn't necessarily a bad thing when you're learning. That hacky prototype system I made helped me understand OOP far better than just using classes in other languages had. Even if it didn't really work all that well in the end. It really made me appreciate what a built in class system actually gives you.