Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

I just had a look at minetest but then I saw it uses Lua.

Name: Anonymous 2015-10-03 22:54

While web-development is plagued by PHP/Perl/JS/Ruby/Python scourge, video game development too has its share of bad languages. Most hyped and infamous of them being Lua:
- Broken lexical scoping: assignment acts as declaration, clobbering global variables. Even worser: access to undeclared variable doesn't produce error, but silently returns nil. Bad scoping is the single biggest source of bugs and confusion (http://lua-users.org/lists/lua-l/2008-11/msg00008.html). Moreover, every variable access goes through hashtable system, producing several L2 cache misses in process, making Lua slower than comparable alternatives, like Lisp. Lua has no standard way to do OOP or define a module, leading to numerous incompatible and badly designed solutions, resting on top of already deficient hash-table system with a.b[i]:c(d) style scope resolution. Like in all badly designed languages, Lua pollutes global scope with `_` prefixed identifiers, instead of keeping them in a separate package.
- Hash-Table as a primary data structure has overwhelming issues. There is no simple and safe way to implement Lisp-like FIRST and REST functions: either you have to copy whole Table or modify it, and sequential access is somewhat slow. There is no easy way to remove an element from a list. Even worse, the size of a list may not be what you expect: "b={'x'};b[2]='y';print(#b)" prints 2, but "b={'x'};b[3]='y';print(#b)" prints 1. Table indexing starts from 1, acting as a source of errors and confusion, when interfacing with external APIs or converting algorithm from Lua to C/C++, while 0 still acts as a dangling pointer. Lua Tables don't provide advantages of immutable catenable queues - a silver bullet data structure, you'll find in modern Lisps and Haskell; Lua Tables are mutable and encourage modification, instead of creation, meaning there is no easy way to do functional programming with Lua. REPL wont pretty-print tables, but dump something like "table: 0x807e978". Table-list features some of the scariest kludges: program can modify the behavior of the length operator for any value but strings through the __len metamethod, while table construction syntax and semantic are impenetrably confusing, like { [f(1)] = g; "x", "y"; x = 1, f(x), [30] = 23; 45 }
- Lua uses floating point values to represent integers, so 9999999999999999999==10000000000000000000. In general, Lua's logic seems odd: "nil+1" produces error, while "(not nil)+1" gives 2. Things could be unequal to itself: `t={[{1,2,3}]="abc"}; print(t[{1,2,3}])` wont print "abc", meaning that `{1,2,3} != {1,2,3}`.
- Lua's syntax is inconsistent and full of quirkiness: underscores for special variables and cryptic symbols for simple functions, like `#xs` for `length(xs)` and `x = start,end,step` instead of range(start,end,step), while logical connectives (`and`, `or` in place of `&&`, `||`) are hard to notice between other symbols, and do/then/end everywhere could be annoying. Moreover, `t = {"a","b","c"}; print(t[2])` works, but `print({"a","b","c"}[2])` fails. `print 'hello';` works, but `print 123;` fails.
- Lua is unstable: API changes frequently, functions are being added and deleted continuously, `table.foreach` being a good example of to be deleted function, and then there is `table.unpack`, which present only in some versions of Lua.
- Lua's GC is a naive mark-and-sweep implementation, which stores the mark bit directly inside objects, a GC cycle will thus result in all objects being written to, making their memory pages `dirty` and Lua's speed proportional to the number of allocated objects. Lua simply was not designed to support hundred thousand objects allocation per second.
- Lua was built as a glue language, and it shows. Much of Lua hype comes from it's usage as a simple integrated scripting language in video games industry. That makes typical Lua user a teenage gamer with little expectations or taste for computation features and productivity.

Name: Anonymous 2015-10-04 3:45

Torch is pretty good.

Name: Anonymous 2015-10-04 6:41

"Broken lexical scoping: assignment acts as declaration, clobbering global variables."
But that's not true.

Name: Anonymous 2015-10-04 8:07

>>3
It is if you don't use local. It's not like we can be expected to read the docs you know.

WAYBST?

Name: Anonymous 2015-10-04 10:27

>>4
local should be the default behaviour. Unless you are The Supreme Shitcoder there will be more local variables than global ones.

Name: Anonymous 2015-10-04 16:06

there will be more local variables than global ones
This is not the case with most suckless software.

Name: Anonymous 2015-10-04 16:26

>>6
suckless?

Name: Anonymous 2015-10-04 16:42

>>7
Are you a 12yo from /g/? How can you not know what suckless is?

Name: Anonymous 2015-10-04 16:45

>>6
Maybe they should write their software in Lua then.

Name: Anonymous 2015-10-04 17:33

>>1
You are a sad, broken person. I feel sorry for you.

Lua is beautiful. It is very fast and very small. Your shitpost is the same as saying "when I use this powerful weapon to shoot myself in the foot, my foot starts bleeding profusely".

You are a miserable imbecile.

Name: Anonymous 2015-10-04 17:42

>>1
There is no simple and safe way to implement Lisp-like FIRST and REST functions: either you have to copy whole Table or modify it, and sequential access is somewhat slow.

function makelispthing(car, cdr)
return { car = car, cdr = cdr }
end

lispthing = makelispthing("go fuck yourself", makelispthing(nil, nil))


You are a foolish shitposting imbecile who is much better at whinging than at programming.

Name: Anonymous 2015-10-04 18:50

>>5
local should be the default behaviour

I agree, but I would still rather use Lua than PHP. I'd rather not use either though.

Unless you are The Supreme Shitcoder there will be more local variables than global ones.

I doubt this is so in game scripting. I am using Lua for that right now and there are zero locals so far.

Name: Anonymous 2015-10-04 20:43

/prog/riders always complain about everything

Name: Anonymous 2015-10-04 20:57

>>13
Someone get this hot-head outta here

Name: Anonymous 2015-10-04 23:35

>>11
Lol, retard.

Name: Anonymous 2015-10-05 0:53

>>3,4
It's not perfect, but you can catch a lot of mistakes with require "strict".

Lua is okay for its intended purpose (embedded glue language for C or C++ programs). You aren't going to find a language implementation in that space with fewer warts, which is a little unfortunate because it certainly has plenty of them.

Name: Anonymous 2015-10-05 1:02

It could be worse.

Name: Anonymous 2015-10-05 1:31

>>16
You aren't going to find a language implementation in that space with fewer warts

Forth, Scheme and Io all have implementations in that space with considerably fewer warts.

Name: Anonymous 2015-10-05 1:42

>>18
Having a small or technically divided community is a big wart.

Name: Anonymous 2015-10-05 1:54

Ex-Squirrel gamedev here. From what I've seen of lua squirrel is far more polished, but it still has the everything is slow hash tables problem, crappy GC, everything is mutable, and other general suckness of dynamic languages. It would be fine for just scripting but people were using it for much more and abusing the shit out of the dynamic typing.

Thank god the place I work now does everything in glorious sepples .....

Name: Anonymous 2015-10-05 3:56

>>12
PHP has local variables by default. PHP has 0-indexed arrays. PHP has strong leader Rasmus-san.
It is by all measures superiour language.

Name: Anonymous 2015-10-05 4:01

>>21
superiour
brits get out

Name: Anonymous 2015-10-05 5:07

Having a small or technically divided community is a big wart.

Said >>19-kun, who has never written game script in his life.

You write for the game environment which will be quirkier than an implementation differences. You make API calls, never system calls, and hardly ever library calls (no lib support in the implementation I'm using.) The implementation can be a bizarre remix of the original language but it hardly matters. The Lua script I'm writing now: zero bugs from array indexing, zero from scoping problem. Performance is great! Most bug come from param being passed by value or reference based on the phase of the moon when the line of code was written, or anything to do with meta tables.

Besides, Lua community is already small and technically divided.

Name: Anonymous 2015-10-06 1:35

>>1

Arrays based at one are negative fun

Name: Anonymous 2015-10-06 5:12

>>23
Besides, Lua community is already small and technically divided.

Not as much so as the Scheme, Forth, or IO communities, though - which was my original point. Obviously there is a point at which popularity matters, or people would be creating a new language for every game.

Name: Anonymous 2016-11-27 19:08

>>11
Couldn't the second argument just be nil, rather than makelispthing(nil, nil)? I don't have much experience with lisp, but I thought the idiomatic form of a list would be (cons 1 (cons 2 (cons 3 nil))), not (cons 1 (cons 2 (cons 3 (cons nil nil)))).

Name: Anonymous 2016-11-27 21:24

F O U R T H

The British version of Forth.

Name: Anonymous 2016-11-27 21:48

四番目

The Japanese version of Forth.

Name: Anonymous 2016-11-28 10:40

>>26
it should have been the way you said, because that's how a linked list is usually defined: a collection of two-element nodes, with the first element holding the value and the second one holding either the rest of the list (if not last) or nothing (if last). a node holding two nothings is pointless

Don't change these.
Name: Email:
Entire Thread Thread List