Readit News logoReadit News
catdawg commented on A History of Lua (2001)   lua.org/history.html... · Posted by u/atan2
einpoklum · 3 years ago
Why only the history until 2001? What about the years since then?
catdawg · 3 years ago
The article was written in 2001.
catdawg commented on A History of Lua (2001)   lua.org/history.html... · Posted by u/atan2
HEHENE · 3 years ago
I love to see the Lua love on HN, especially given my other languages of choice are generally disliked around here.

Funny enough, I was just mentioning to a friend this weekend that I would love to write Lua as a full time job (and particularly in gaming), but those jobs seem nearly non-existent.

How do you recommend going about finding opportunities like yours?

catdawg · 3 years ago
If you want to work on "AAA" games, I don't think there are many companies left using it to this scale. An engine where those kind of games are developed almost fully in Lua, AFAIK, is Bitsquid (later Stingray by autodesk), but that has been discontinued. There are still some companies that use Bitsquid derivatives though, like Fatshark, Toadman and Arrowhead. See https://en.wikipedia.org/wiki/Bitsquid

As for non "AAA", I think https://love2d.org/ is quite popular for game jams and commercial 2d games - I haven't used myself though.

So maybe look for opportunities in companies using those engines.

catdawg commented on A History of Lua (2001)   lua.org/history.html... · Posted by u/atan2
Rochus · 3 years ago
> a large lua game code base, over 4000 files, 1.5 million lines of code

Interesting; how do you manage to keep consistency? Do you have special tools to e.g. detect inadvertent global variables? I once wrote a Smalltalk VM in Lua (https://github.com/rochus-keller/Smalltalk/blob/master/Inter...) which is a much smaller code base, but even with this modest size I quickly would have lost track of e.g. scopes and names without tools I had to write myself (https://github.com/rochus-keller/LJTools).

catdawg · 3 years ago
Most of the time nothing is used. The thing is that iterating is so quick, that you find the problems really fast.

Although, I've been using luacheck https://github.com/mpeterv/luacheck. It is quite nice, but you have to write down the global variables by hand on the config file.

Edit: Also, the vscode lua plugins have been getting quite good, and completion works to a certain extent.

catdawg commented on A History of Lua (2001)   lua.org/history.html... · Posted by u/atan2
catdawg · 3 years ago
I've worked now for 3 years on a large lua game code base, over 4000 files, 1.5 million lines of code.

In the first week or so, I was a bit weirded out by the lack of language features, as I come from C#/Typescript/C++, but I was very surprised that after 2 or 3 weeks, I was already doing very complex tasks on the code base.

I think a lot of that comes from the simplicity of the language. It's very difficult to surprise you, everything works in pretty much the same way.

Here are some things that I will miss once I move to other languages: (note that most of these are not things that come from simply using lua, you have to implement it into your framework/engine, but they are still pretty common)

- stack traces print the contents of the variables in the stack. Not all lua code bases have this, but it is easy to implement.

- if the code crashes, you can fix the code and continue. This doesn't always work, and requires the code base to be written in a way that supports it, but it is definitely possible and I've used it many times.

- debugging works really well. You can easily attach and inject code, stop on exception and inspect the state.

- settings are also lua code. This is probably the biggest thing I'll miss. I love being able to have simple functions as part of settings (e.g. things like tweening functions), being able to generate settings based on other settings, or run simple sanity checks, all on the same file.

- index starting on 1, this is definitely an unpopular opinion, but IMO it just makes things so much easier. When you need to access the last element, you just do tbl[tbl_length], no need to decrease by 1, or doing a for loop, you only specify the indices you're actually accessing "for i = 1, last_index do end". I think it really helps with off by 1 errors. I used "normal" indices for over 10 years before this project, and I would still occasionally have these errors, but with lua, I don't really remember having them.

- not having to fight the compiler to quickly try out different things. Need something from a completely different system? Just add it to the global table and access it from the other place.

A big learning I got from transitioning from languages with a very strong type system to a dynamic language like lua, is that in order to be effective, you really need to use code architecture patterns, otherwise things become very hard to reason with. This might be counter intuitive, but I think you need to be a better programmer to use lua effectively, than you need to with a language like C# or Typescript. With the latter languages, the compiler helps you a lot, but with lua, you have to know how to use these things on your own, because you can pretty much do anything and that can be reeeeally bad :)

catdawg commented on Instanced Line Rendering Part II: Alpha Blending   wwwtyro.net/2021/10/01/in... · Posted by u/colinprince
rebuilder · 4 years ago
Is it not possible to use a different operator for alpha blending? So instead of a1 + a2, do max(a1,a2)?
catdawg · 4 years ago
Yeah, I had exactly this problem before. I tried to wrap my head around how to actually do it geometrically, but thankfully had the much easier idea of just using the blend op.

This is super useful though! You don't always have the ability to change the blending op, or you could be rendering on top of something that might give you artifacts. Thankfully I was rendering something like this on a blank canvas.

catdawg commented on Beyond Meat’s Beyond Burger life cycle assessment (2018)   css.umich.edu/publication... · Posted by u/aracena
catdawg · 5 years ago
I've tried Beyond Burgers and I quite like them. Sure it's not the same, but honestly, I don't really care that it tastes the same. I've also tried other burgers that do not try to mimic burgers and just create a new taste... and I also really like them! sometimes even more.

I believe in just reducing meat consumption. I think meat should be a lot more expensive because when you purchase it, you should pay a tax for the environmental impact. That way, hopefully eating meat becomes a luxury, and not something you eat always at lunch and dinner. And even if it does not, at least the money collected from this tax could go into environmental programs.

catdawg commented on Zuckerberg is creating a new criminal justice reform group backed with $350M   vox.com/recode/2021/1/27/... · Posted by u/giuliomagnifico
credit_guy · 5 years ago
Some people like to do good. In fact, most people like to do good.

Ask any kid what they want to be when they grow up and no one will say "I want to become a scary ogre".

I want to do good, and most likely you want too. Zuckerberg and Musk and Cuban, apart from their money, are people like me and you. They don't wake up in the morning and think "how can I be a scary ogre today". They want to do good, and they happen to have the money to do it.

Why is this miserable?

catdawg · 5 years ago
I think the problem here is that we moved away from Monarchies/Feudalism for a reason. If we let single people or families completely control the direction of legislation and justice systems, at some point it will go terribly wrong. Sure right now, Zuckerberg or Musk or Cuban, might be cool dudes with the right intentions and making great things, but what happens when they're gone? Who's going to take control of all that wealth and power?

Democratic states aren't perfect, but at least there are fail safes against the wrong people having power at the wrong time. The people supposedly all collectively own the wealth and direction of a state, so a single person can never be that powerful. Authoritarianism or dictatorships will always feel appealing in the face of dysfunctional governments, because there is always someone who is actually good at they do, and effects real change (if you disregard all the usual xenophobia/populism/oppression). In this case, you can see people saying "government is not doing anything about this, so why shouldn't these people fix it". Power eventually corrupts, if not the person then its descendants, at some point it goes terribly wrong and itends up tearing a society apart. This has happened pretty much everywhere.

Also the level of wealth some people are accumulating right now is absolutely unheard of in history. You can now "easily" have a business that reaches billions of people from your basement. If this exponential accumulation of wealth continues, government as we know it will become obsolete, and democracy will stop functioning because some people just have too much lobbying power.

catdawg commented on Right to Repair off to the races in 2021 with 14 active states   uspirg.org/blogs/blog/usp... · Posted by u/CharlesW
catdawg · 5 years ago
I think this is more of an issue of sustainability. I wish that there would be some system where each product that is put on the market would have to provide a sustainability analysis, and pay more/less taxes depending on this rating. This analysis could be something like "what happens to the materials after it becomes obsolete?", "how long is it going to last under normal usage?", "How biodegradable is the packaging?", etc.. This would force companies to actively look for ways to improve this rating, and hopefully lead to better practices overall.

Some products are just too difficult to repair, or just pointless to repair past a certain age as they become obsolete (like a phone). But they can be safely and cost effectively be recycled in bulk.

catdawg commented on Electron 11.0 released with support for Apple Silicon   electronjs.org/blog/elect... · Posted by u/binarynate
TameAntelope · 5 years ago
I'm both sad and confused about why there are so many negative comments about Electron, when I happily use Electron apps every day of my life and have no complaints at all about them. In fact, I'd like to start building Electron apps of my own, it actually looks like a ton of fun!

What is the experience I'm missing?

catdawg · 5 years ago
I think any technology where you can get something done quickly, and blurs the line between production and prototyping, gets a bad reputation because a lot of people misuse it. Essentially, I think you need to be able to have a strong engineering culture that takes the time to actually optimize things as the scale/scope changes.

As a not quite accurate example, think JS vs C++, there's no way you can hammer a bunch of C++ to get something working without not shooting yourself in the foot multiple times, so you have, to a certain extent, to properly develop it from the start. Whereas with JS, you can probably get something working quickly and prove your point. And it's very easy for this shitty JS solution to end up in production because it just works.

You can write very good JS code if you have the engineering culture for understanding it's importance, while with C++ it will be somewhat good from the start because it has to be. I think here is the same thing, for example what has been mentioned here, VSCode vs Slack.

catdawg commented on Kosmonaut: web browser from scratch in Rust   github.com/twilco/kosmona... · Posted by u/adamnemecek
catdawg · 5 years ago
Could something like this be used as the renderer for desktop applications? Instead of running a full fledged browser like electron, you basically just write all the logic in rust, and render the UI with css+html.

u/catdawg

KarmaCake day59August 16, 2018View Original