/g/ - Technology

install openbsd

[Make a Post]
[X]





Nanonymous No.1190 [D][U][F][S][L][A][C]
File: 50725ad26aa0d63142026469f7a1c597dc28ca82ca433f54b91f020dc707c955.png (dl) (72.10 KiB)

LUA. What can you tell me about it and which learning resources do you recommend? Is it relatively popular?

Nanonymous No.1192 [D] >>1194 >>1198

>What can you tell me about it?
It's my primary scripting language of choice because it's fast, portable and simple. The only language faster than Lua(JIT) is a compiled language.
>Which learning resources do you recommend?
Read the PiL book (https://www.lua.org/pil/contents.html). However, that's for the old version 5.0, because they want to jew you out of shekels, so after you've done that, install Lua 5.3 and read the reference manual (https://www.lua.org/manual/5.3/).
Don't bother with using shitty old versions of Lua, it's a pain in the ass. Always update your code for the newest version when it comes out.
>Is it relatively popular?
It's quite popular as an extension language for games - this is because its speed is high compared to other interpreted languages.

Nanonymous No.1194 [D][U][F]
File: 59f84e1d839de88532cda77dae170eb1a12aeae37cb42006d9586fd6d231107a.jpg (dl) (25.62 KiB)

>>1192
>t. hakase

Nanonymous No.1198 [D] >>1199

>>1192
What's the difference between the 5.0 version and the fourth edition?

Nanonymous No.1199 [D] >>1200

>>1198
idk, i never programmed on 4.x
just use either 5.1 (if you want luajit) or 5.3, there's literally no reason to use any other version

Nanonymous No.1200 [D] >>1201

>>1199
Was talking about this https://www.lua.org/pil
It's the newer editions link on the page you posted

Nanonymous No.1201 [D] >>1202

>>1200
oh that, the 4th edition is for the latest version of lua. But it requires (((purchase))) and I don't think it's worth it, the main difference between 5.0 and 5.3 is basically just bit operators and a few small improvements which you can get from the reference manual/changelog/whatever.

Nanonymous No.1202 [D]

>>1201
So there's not much difference between the editions, not like I wasn't going to just pirate the pdf anyway, I won't bother then

Nanonymous No.1216 [D][U][F]
File: b420442e0d244cd3267a090fcec44e3e3867ec2dfdb5d5aed265cfcbb351d79e.pdf (dl) (849.01 KiB)

Found the 4th edition on libgen. There's also a 1mb and 7mb version of this pdf, not sure why the size disparity, but this one seems to be complete after looking through it.

I've been wanting to pick up another scripting lang that isn't Python. The 'closeness' with C is cool too.

Nanonymous No.1219 [D] >>1220 >>1225 >>1270

Does anyone recommend a text editor which comes with LUA?

Nanonymous No.1220 [D]

>>1219
I'm under the impression that vis uses lua for scription, though I haven't tried it.

Nanonymous No.1225 [D]

>>1219
textadept

Nanonymous No.1226 [D] >>1231

Why is OP and a bunch of faggots in this thread calling it "LUA"? The name is "Lua". You guys look like the retards who say "TOR", which is also incorrect btw.

Nanonymous No.1246 [D] >>1247

There's a lot of cool stuff you can do with LUA in vidya. I remember playing with scripts for Counter-Strike 2D and a more recent game would be From the Depths.

Nanonymous No.1247 [D]

>>1246
You can't not mention gmod.

Nanonymous No.1270 [D] >>1271

>>1219
>What about a text editor?
Learn Emacs and you'll never have to ask that question again. As a bonus, you also wont have to look at niggers begging for gibs, either.

Nanonymous No.1271 [D] >>1272 >>1274 >>1285

>>1270
>regularly opening your editor with no file
why?

Nanonymous No.1272 [D] >>1285

>>1271
exactly. I didn't even notice the niggers message because usually I use `touch` to create the file before using the editor, if I need a new file. This is because I like to confirm that I have sufficient permissions to make a file; I don't like not being able to save a file and having to copy it out of some temporary location with doas.

Nanonymous No.1274 [D] >>1285

>>1271
this. i never knew what people were talking about with the nigger message until recently because i always did vim file.

Nanonymous No.1285 [D][U][F] >>1286 >>1288
File: adc46a4cfb1e47245a2d86e221f0b5d35f7e7f5c219140fca49f740230dce2ea.jpg (dl) (79.86 KiB)

>>1271
>>1272
>>1274

Guess you faggots never went to the vim website either? Why support nigger lovers? I don't understand.
> We must secure the existence of our people, and a future for white children...
< unless the nigger lovers and kikes make something I like.

Nanonymous No.1286 [D]

>>1285
Ok, so (neo)?vim is shit because they assist niggers. So use busybox's vi or nvi (distinct from neovim) instead.

Nanonymous No.1288 [D] >>1292

>>1285
Why would I visit the vim website, when vim came with my system? And how does using vim help Bram at all? And in what way does helping niggers in far off countries endanger whites? And how is any of this on-topic in a lua thread?

What do you people think of semantic whitespace? I always thought it was a good idea, but I see people shit on it, and no one uses it for new languages. You are going to properly indent your code anyways, and your indentation describes how you expect your code to interpretted. Consider the c code:
#define X if(y) z()
if(a)
X;
else
b();
Clearly this code does something different than intended. Why not make the expected behaviour the actual behaviour? I'd take it a step farther: operator precedence should be determined by whitespace as well. Consider the expression: "a*b + c*d". Compare it with "a * b+c * d". Shouldn't they behave differently?

This is only marginally more on-topic than endless kvetching from /pol/ users, but lua takes the traditional approach of ignoring whitespace, plus it terminates blocks with end rather than a curly brace (same as ruby, and similar to bash or viml, but not something I've seen in a real programming language). I'm wondering why people prefer such a bulky system over the relatively plain regime of semantic indentation?

Nanonymous No.1292 [D][U][F] >>1297
File: a0f6034c3ed4ec197eb06e96446ee2ca6521e5bc2d9183d66a0fa482da4747e5.png (dl) (179.86 KiB)

>>1288
>And how does using vim help Bram
Who the fuck is Bram?
>in what way does helping niggers endanger whites?
It increases the nigger population and then they flood over here because muh refoogeezz!!!
>And how is any of this on-topic
Because Lua is a programming language, and programs are made with editors.
>You are going to properly indent your code anyways
No compiler knows what the proper way of indenting is. (muh tabs vs spaces). No compiler is going to be smart enough to parse the multitude of completely sane whitespace formats. Symantic whitespace is a recipe for highly ambiguous bullshit like the pajeetscript return {} vs return\n{}.
>Clearly this code does something different than intended.
That's because not putting braces around your blocks is retarded. Furthermore, not wrapping your macros in do {...} while (0) blocks is also retarded. Your problem only comes into existence when two (2) retarded coding practices are used simultaneously. I.e. fix your fucking code.
>Consider the expression "a*b + c*d" and "a * b+c * d"
>Shouldn't they behave differently?
No. Absolutely not, you fucking idiot. Order of operations must take precedence. If you want to override those rules then you use brackets. Do you want your shitty programs in your shitty programming language to break because someone pressed the space bar in an innocent-looking block of code?
>Lua takes the traditional approach of ignoring whitespace
Yes, and that's a good thing (tm). Sometimes short statements can fit on one line e.g.
if ((a > b) or (c < d)) then break; end;
I don't want those statements to be forced into whatever brain-damaged standard the writers of the programming language came up with. For example, the "standard" spacing for Lua code is 2 spaces. That looks like shit and the different blocks blur into each other. C code is optimally formatted with 8-space (tab) indentation, because C code with high levels of indentation should be refactored. Lua code is optimally formatted with 4-space indentation because the acceptable levels of nesting are higher. 4 spaces is the minimum readable indentation level for Lua. For HTML, 2 spaces is the optimal level of indentation because HTML often needs to be very deeply nested.

Nanonymous No.1297 [D] >>1298

>>1292
>No compiler knows what the proper way of indenting is.
It detects it automatically based on the indentation of the first line.
>Symantic whitespace is a recipe for highly ambiguous bullshit like the pajeetscript return {} vs return\n{}.
Note that this wouldn't be a problem if lua had semantic whitespace, because it's grammar can always tell where a statement ends.
>order of operations must take precedence
order of operations is a holdover from before there were more than two operators. It's idiotic to hold onto it so tightly when better systems exists. It's especially stupid in languages that allow user defined operators like haskell or nim, but still silly in a language like lua.
>If you want to override those rules then you use brackets
brackets are hard to parse with your eyes. See lisp.
>pressed the space bar in an innocent-looking block of code?
It already breaks if they press a letter key, or a number, or a symbol. Actually it already breaks on space if they press it in the middle of a token. The only reason you wouldn't expect a badly placed character to break your program is historical precedence.
>Sometimes short statements can fit on one line
Python allows this:
if a>b or c<d: break
or even:
f1(); f2();
>I don't want those statements to be forced into whatever brain-damaged standard the writers of the programming language came up with.
Python lets you choose the number of spaces or to use indents. Python 2 let you interleave them assuming 1 tab == 8 spaces.
>if ((a > b) or (c < d)) then break; end;
or
if ((a > b) or (c < d)) then break end
because lua ignores semicolons

Nanonymous No.1298 [D]

>>1297
One particular example of a syntax ambiguity caused by treating whitespace this way is (in Lua) as follows:

function raf()
return function(f) return function() f("hello world") end end
end

raf()
(print or io.write)("top kek")

The last two lines of the above example could be interpreted in one of two ways:

raf();
(print or io.write)("top kek");

or

raf()(print or io.write)("top kek");

Currently the second scenario is assumed ("hello world" is printed) but you can see how this leads to problems. Explicit usage of non-whitespace characters (such as semicolon) after all statements is how this is solved. That is why I always remember to put semicolons at the end of statements in Lua. It solves a lot of weird bugs, since with the above example, it would seem that raf() would be called (discarding the return value) followed by print("top kek").

Nanonymous No.1322 [D] >>1328 >>1336

What do you guys use for webdev? Lapis? Sailor?

Nanonymous No.1328 [D] >>1345

>>1322
>Lapis
>Sailor
fuckin BLOAT
Just use haserl so that you don't need to rewrite CGI processing code, and that's good enough for every dynamic website

Nanonymous No.1335 [D]

It really bothers me that "scripting" and "programming" is used interchangeably :(
I always wondered how pajeets, niggers and sjws called themselves "programmers" when I know for a fact none of them are smart enough to make a function from scratch, especially in a low level language.

Nanonymous No.1336 [D][U][F] >>1337
File: 3dba1cfdd7ce0911af1c08c1bf462f8efa836691344e010692adec00f78aa5b3.png (dl) (1.19 MiB)

>>1322

Just my opinion, but lapis does thing is totally retarded ways. The author of lapis also came up with "moonscript" https://moonscript.org/

I usually praise Lua for having really good ecosystem compared to javascript, but ldoc, and lapis are examples that stick out to me as "I really hope this dosn't get popular".

Nanonymous No.1337 [D]

>>1336

Dear god, do I usually spell like a retard without a spell checker?

*lapis does things
*having a really good ecosystem
*hope this dosen't

Nanonymous No.1345 [D] >>1346 >>1347

>>1328
>haserl

I hope you are not trying to make me fall for a meme. You do seem to know more than me so i will listen.

Nanonymous No.1346 [D]

>>1345
Hasel is literally just a simple C program that puts the GET and POST parameters into Lua arrays, faggot. It's not a shitty meme and it's objectively the best way of doing it.
e.g. with haserl:

if (POST["comment"]) then
save_comment(POST["comment|]);
io.write("Comment submitted");
end

Nanonymous No.1347 [D] >>1361

>>1345
It's literally the software that runs this site. Too bad it's abandonware though

Nanonymous No.1361 [D] >>1362

>>1347

> abandonware

What features do you think it still needs?

Nanonymous No.1362 [D][U][F] >>1365
File: bbafd287a40af386d988c5c7fb320e93652ae9fd6f0b9f2d7075646b1357b10f.jpg (dl) (35.71 KiB)

>>1361
>What features do you think it still needs?
automatic banning of anyone who uses reddit spacing

Nanonymous No.1365 [D] >>1366 >>1367 >>1370 >>2467

>>1362
You are just pushing a dumb stereotype.Most of us old timers use spacing because we are used to making long forum posts. I am probably 50% older than you so i don't expect to be understood.

Now could you help this old man out a little bit? There are so few resources on LUA web development online and i am not sure where to start.

Nanonymous No.1366 [D][U][F]
File: 7b3752ed9fd0b3c0c19ca90ce2cf59c793293ab6de8089d328c146452513781f.jpg (dl) (74.33 KiB)

>>1365
>we're used to making long forum posts
>haven't dropped the habit even though forums died 10 years ago
gee whiz grandpa, has your brain fucking calcified or something?

Nanonymous No.1367 [D][U][F]
File: c0f0fc30ce6c9d2ea0cd9c4df89f69ca2f1898e8cc24cdb35e3bc3c617b15378.png (dl) (901.30 KiB)

>>1365
To answer your question though, look at nanochan's source code. Though with your rotten boomer brain I'm not sure you'd learn much.

Nanonymous No.1370 [D] >>1374 >>1572

>>1365
Don't waste your time. Lua web development is like taking up unicycle riding. It looks kind of cool when it's done well, but there is no practical reason to do it.

Go, Django and even JS frameworks like Angular are much more practical and useful to learn. Somebody might tell you PHP, but don't be fooled.

Nanonymous No.1374 [D][U][F] >>1377 >>1384
File: 29c94233f4b2579f35ffcd2c1acff11cc8127f9dec8e33e19049c1ee1ab4c150.png (dl) (294.01 KiB)

>>1370
>there is no practical reason to do it
Except that Lua is one of the fastest interpreted languages in existence, even faster if you consider the existence of LuaJIT. Lua has less bloated code and backwards-compatibility bullshit than israeli languages like (((PHP))), or bloated crufty pajeet/object-oriented languages like Perl and Python. There is literally no reason to use one of those piece of shit languages when you have the option of using Lua or C.
>Go
Go is meme jewgle shit. It offers nearly no advantages over C, and its compiler is slower than C++. The generated executables are multiple megabytes in size by default. Imagine if everything in /bin/ and /usr/bin/ was over 3MB in size. The binaries alone would consume multiple gigabytes of disk space, and cause cache problems in the CPU, slowing everything down. Go is a piece of shit.
>JS frameworks
Are you a literal fucking pajeet? JS frameworks are the epitome of cancer. JS pajeets make libraries for the max() function alone, for fuck's sake. Un-fucking-believable. Go kill yourself. Or go back to any other imageboard if you want to have pajeetscript stuffed down your throat. Useless pajeets like you are why computers are getting slower and more error-prone every day.
>inb4 MUH JAWBS
Kill yourself. Working in mcdonalds is better than getting a "programming job" due to the amount of utter and absolute cancer involved in modern "programming". Everybody worth their salt does it for free.

Nanonymous No.1377 [D]

>>1374
Try making a website in C, then try making a website in Go. The difference is night and day.
All the static shit is generated automatically via go generate, libraries are super easy to use since they're always documented. Have you tried using crypto in C? Go standard libs are what the stdlib actually should be.

Not gonna lie, compile times are slow (up to a few seconds) on my non-botnet CPU, and I miss manual memory management. But the ease of development far outweighs the rest.

Nanonymous No.1380 [D]

>Try making a website in C
implying he isn't already doing this

Go is nigger shit.

Nanonymous No.1384 [D] >>1385 >>1386

>>1374

Please name a web application you have developed with your autistic language prefetence that isn't
A) trivial
B) a refactor of an existing application (ie this image board)

Protip: you can't

You can hate on pajeets for using angular, which I'm not calling elegant, but they are writing actual applications. You know. Stuff on the internet? As opposed to bitching about artificial benchmarks to the 3 other people on this board. Which is the more performant solution: a JS Frankenstein cobbled together out of pre-made libraries in a few hours, or your perfect, elegant, supple Lua implementation that doesn't exist?

Nanonymous No.1385 [D] >>1387

>>1384
this has to be some sort of /r/programming pasta

Nanonymous No.1386 [D] >>1387 >>1388

>>1384
>Waah if you are making improvements on a prototype that means it isn't reeeeeeel programming
>But pajeetscript is reeeeeeaaaal programming amirite!
I think you are trolling now.

Nanonymous No.1387 [D] >>1389

>>1385
>>1386

So no examples of your work that you would like to share with the class?

Nanonymous No.1388 [D] >>1390 >>1391

>>1386
>Improving
I think you might be trolling. This site is not better than masonchan from a technical perspective.

Nanonymous No.1389 [D]

>>1387
this isn't pajeetoverflow

Nanonymous No.1390 [D]

>>1388
>This site is not better than masonchan from a pajeet perspective.
true

Nanonymous No.1391 [D]

>>1388
>This site is not better than masonchan from a technical perspective
Hey, I have a place you might like to go.
https://8ch.net/india/

Nanonymous No.1393 [D] >>1408 >>1572

Boards are only viewable in catalog format for simplicity. There are far fewer features. I have to type in post IDs. Really the only thing that's an advantage is that it's a hidden service. That also means a couple spammers can render it unusable, so the only security is achieved by being a low value target

Nanonymous No.1408 [D][U][F] >>1434 >>2391
File: d48d0b170d384e2c77a7e5d3d1d00154de03d75253c3b2801c5b97b26e404425.png (dl) (828.71 KiB)

>>1393
>Durr simplicity bad!
>Harrrr muh features!
>Muh extra typing!
<not knowing that hakase + few global vols deleted over 5000 spamposts during spammer-kun's tyranny
Newnormalfag.

Nanonymous No.1416 [D]

So the advantage is post quality? We know that's not true

Nanonymous No.1434 [D] >>1435 >>1436

>>1408
I love this website and how it is made. But i am better off learning javascript since people like you are unwilling to give any sort of advice.

Because i have no background in CS any only know programming from hobby game development in Unity i feel like fish out of water here.

Nanonymous No.1435 [D]

>>1434
>i am better off learning javascript
Go do that, and make a nice userscript for this place

Nanonymous No.1436 [D]

>>1434
Don't worry. Nobody here actually knows what they are talking about.

Nanonymous No.1560 [D] >>1564

Could anyone give me an example of lua at work? Something like a short program of sorts.

Nanonymous No.1564 [D]

>>1560
you're using it right now

Nanonymous No.1572 [D]

>>1370
>django is much more practical and useful
AHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
>>1393
Literally which corporation's cock are you sucking off when you imply an onion service is magically more vulnerable to spam? I can't even imagine what retarded fucking idea you had when you wrote your post.
>have to type in post IDs
The only workaround for that is using JS, which is far worse overall. Web applications are a hack, there will never be real support for even a feature this mundane. Meanwhile, this chan lets you post from Tor without cookies, referer [sic] headers, or JS.

Nanonymous No.2391 [D][U][F] >>2398
File: befa73ce9a6c82d470c14887e6ea0125bee1653c75be77f19ab9757fd8f45c0f.jpg (dl) (36.04 KiB)

>>1408
>Newnormalfag.
a shame that the Hacker News faggots always find us so quickly. I'm only sorry we didn't optimise their ancestors out of the gene pool on the first compiler pass.

Nanonymous No.2398 [D][U][F]
File: 1cad8124c3e2f2d57efd4d349f7e51a1c5fdaacb9d2ef09b0864679fac9f8896.jpg (dl) (38.14 KiB)

>>2391
>compiler fucked up something important and now we have faggots to deal with
That's why God should have used assembly language

Nanonymous No.2466 [D] >>2468 >>2483

Frankly, Tcl is a better scripting language than Lua. Learn Tcl.

Nanonymous No.2467 [D]

>>1365
Excessive spacing is bloat. Reserve it for paragraph separation only. And by that I mean actual full blown paragraphs and not 2 sentence pseudo-paragraphs. If your ideas are jumping around to the point where you feel it necessary to start a new paragraph after just a few sentences then you're clearly writing like some kind of nigger, which you do seem to be doing.

Nanonymous No.2468 [D] >>2695

>>2466
I do like Tcl, but isn't it slower than Lua?

Nanonymous No.2483 [D]

>>2466
Tcl is good too. It's bad for doing lots of processing, since it's slow, but its built-in async I/O facilities are excellent. If I were writing a web or IRC server or something, I would definitely use it.

Nanonymous No.2643 [D]

I used lua for a while on a medium-sized project.
+ No compilation, it just runs, hot reloading is easy, great for prototyping
+ Convenient type system
+ Minimal
- Debugging

Overall, it's a great language, but making complex projects would quickly become a nightmare. It's way closer to JavaScript than I expected.

Nanonymous No.2650 [D]

nanochan is written in it

Nanonymous No.2695 [D]

>>2468
Speed is probably Lua = Perl5 > TCL > Python.
Making C extension is extremely easy and there's a LLVM based runtime in the work (https://archive.is/Ibhd9), though.


Nanonymous No.2696 [D]

Nothing wrong with Lua but for general desktop use and server-side scripting work, I'd use Tcl. It works exactly like a shell language in its integration with the unix toolchain, and then offers Tk (which is incredibly fast and lean, by today's standards) and pretty much everything else missing from shell languages. Incredibly versatile. Python really offers no compelling advantages over Tcl, and I'm unsure why it even got popular.

Nanonymous No.2837 [D]

Lua is dead. Rust is the future

https://github.com/dessalines/rust-reddit-fediverse

Rust will save us from Reddit. Are you ready for FedeReddit, nanon? The future of online shitposting lies amongst the stars of the fediverse