[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Lua
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 33
Thread images: 4
File: logo.gif (4 KB, 128x128) Image search: [Google]
logo.gif
4 KB, 128x128
What does /g/ think of of the language Lua?
>>
>>52035242
the creator is a lunatic
>>
It's a good scripting language, easy to learn. Better than getting cancer and many other things.
>>
Tables are weird.
luajit is possibly the best designed jit ever
>>
>>52035258
I don't know if this real or an intended pun
>>
>>52035242
based
>>
Some very smart decisions, some very stupid decisions.
>>
>>52035273
hehe
>>
>>52035242
simple and useful
>>
>>52035242
Gateway into scripting isn't it?
>>
>>52035242
>1-based indexing
literally retarded
>>
>>52035340
What is this?
>>
File: 65.jpg (57 KB, 460x490) Image search: [Google]
65.jpg
57 KB, 460x490
how do you guys deal with things that normally require usage of pointers in language that doesnt have this concept, eg.parsing binary data
const char* str[] = "some binarry data";
int val1 = *(int*)&str[0];

int val2 = *(int*)&str[4];
how would you do that in lua?
>>
File: 1039.jpg (16 KB, 500x500) Image search: [Google]
1039.jpg
16 KB, 500x500
>>52035884
i fucked up string declaration, again
>>
>>52035242
Stay the hell away from it
>>
Arrays start at 1
>>
>>52035242
fucking awesome
>>
>>52035242
It's a great entry-level programming language. It's designed with human readability in mind, so lua source is really easy to read and understand. Even if you know very little about programming, a LUA script can immediately begin to make sense to you.

Yeah, so arrays start at 1. And it's got a tonne more problems, but LUA was never meant as a serious language like C++ or Java or Python.

It was my first programming language ( use to write scripts for this GTA: SA mod called MTA when I was younger. Doesn't seem very complicated, but it taught me the basics of general programming notions like I/O, structure, syntax and how to design a script at a very high level )
>>
world of warcraft is pretty good.
>>
On the surface it seems easy but then you get into metatables and lightuserdata and I don't even
>>
The minimalism pisses me off. Not even a continue statement.
Every for loop looks like:
for i = 1, 10 do
if ... then
if ... then
if ... then
end
end
end
end



>>52035884
local val1 = ("some binarry data"):sub(1, 1)

You only get a copy of the first byte.
>>
seems like a barebones lisp
>>
>>52035884
>int val1 = *(int*)&str[0];

You can't do that in Lua.

You also can't do that in C or C++ though, so I guess they are even.
>>
>>52038582
are you retarded?

if (...) and/or (...) and/or (...) and/or then
end
>>
>>52035242
What's easier to learn, lua or python?
>>
>>52038689
That's not the same.
>>
>>52038689
do you even code?
not using continue
top kek
>>
>>52035258
No. He's just brazilian
>>
>>52035340
Best way to get into scripting at a young age, that's what I learned on
>>
>>52035884
>int val2 = *(int*)&str[4];
What the actual fuck are you even trying to do?
Are you just trying to get the numerical value for a character in a string? Why dont you just (int)str[4]?
>>
>>52035280
>>52038382
This and this. The tables and metatables thing is actually pretty good. Weird, but brilliant.

It has its quirks, but it's in my favourite half of scripting languages.

It's also very fast, particularly with LuaJIT, which - even after V8 - still just about remains the fastest scripting JIT even if its techniques aren't as advanced.

It embeds exceptionally well too, so lots and lots of things use it for plugins and runtime scripting.

>>52038441
...including this. I wrote a few addons. Designing them as high-performance was challenging.

One surprising takeaway: local variables are much faster, because all global variables are table references.

Also, if you're worried about performance, it can have a garbage problem you need to know how to tame. Don't start concatenating strings piecemeal when you could build one, for example. Reusing variables is perfectly okay. And use metatables to memoise (cache) lookups when you can, or for defaults, or for class inheritance...

>>52038710
Python is probably easier to learn, I'd say. It's easier to do really big things with, certainly.
>>
>>52035242
It's an ok, easily embeddable language, making it great for devs to incorporate scriptable logic into their apps or games with comparatively littely effort (as opposed to writing it yourself or using some enterprise scriptbeanfactory).

It's missing a few neat things like terinary operators, 0-based indexing, and unlimited constant references, but what it does implement is done reasonably well.
>>
good way to learn?
Thread replies: 33
Thread images: 4

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.