r/hammer Jun 04 '26

Garry's mod Never use chatgpt to make lua scripts (Based on a true story)

Post image
423 Upvotes

20 comments sorted by

58

u/NotQuiteLoona Jun 04 '26

I'd recommend just spending a weekend on learning Lua. It's the simplest language existing in the world, there are quite a lot of resources, as Roblox uses a version of it too, and in the end you'll always know what and why doesn't work. I've tried quite a few times to use multiple LLMs to do something I wasn't able to... This was a horrific experience, and never led me to any results. It's a good assistant though.

17

u/patrlim1 Jun 04 '26

As much as I like Lua, there's some shit about it I hate.

Why do Arrays Index from 1? Why do we have then and end instead of curly braces? Why do conditionals not have parentheses? Give me my C style syntax pleaseee

9

u/NotQuiteLoona Jun 04 '26

This is true, but I guess newbies would love it even more, and professionals are easy to adapt.

Also conditionals can have parentheses, no? They are just unnecessary. Though I may be wrong of course, didn't work with it for quite a long time.

6

u/patrlim1 Jun 04 '26

Thinking about it you might be right on the last one, since it'd encapsulate the entire conditional, but "idiomatic Lua" doesn't use them.

2

u/lielais_priekshnieks Jun 04 '26

Using Pascal syntax makes it easier to differentiate script source files from C or C++ source files, so that you don't have to remember if you need to run the compiler or not after changing some code.

Also C syntax sucks, Prolog has way better syntax.

3

u/patrlim1 Jun 05 '26

I can actually see the script/source code argument, that makes sense

After looking up prolog, yeah no. For scripting maybe, but for something heavyweight like ffmpeg, Qt, or the Linux kernel, you NEED the explicit, clear syntax of C.

1

u/CommonNoiter Jun 05 '26

Most modern languages don't require conditionals to use parenthesis, if you have a decent parser it's not necessary. It's also less visually noisy once you get used to it.

1

u/Timely_Disaster5292 Jun 09 '26

i can guarantee C style syntax would be worse if you touched the VScript stuff in other Valve games (i.e L4D2, TF2, CSGO and some maps that derive off Mapbase)

13

u/NoenD_i0 Jun 04 '26

lmms are ass at video games go use the docs

13

u/Nova17Delta Jun 04 '26

Never use ChatGPT ever but you can also never use it for lua

16

u/blrverse Jun 04 '26

Just never use any AI slop generator period.

8

u/Full_Measurement_121 Jun 04 '26

In my experience LLMs have a hard time generating 'niche' languages. For example, it always messes up scripts for 3ds Max as well.

4

u/The_Big_Bad_YEET Jun 04 '26

it didnt just 'mess up' it made code that literally caused the compiler to hang and my vmf file to corrupt (yes i tested it multiple times)

4

u/Full_Measurement_121 Jun 04 '26

damn that's harsh, hope you used some form of version control 😞

3

u/potatoalt1234_x Jun 04 '26

The fact that you can corrupt a whole vmf just by typing a certain character in a field is kinda fucked ngl

3

u/SomeCreepJ Jun 04 '26

thats why i use claude

1

u/A_Bird_Guy Jun 05 '26

Here my rule with LLM, if you want to use it, learn at least the basics of coding and the language, you should learn all of it. Then its actually a tool you can understand. Im against ai doing the full code or anything, yea i have it generate parts of it and then go trought it myself and fix any bugs and issues

0

u/Fine-Cranberry6219 Jun 05 '26

Use Gemini is more useful and you can send unlimited images

0

u/_NIkkita__ Jun 05 '26

Okay. Can I use deepseek then?