Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Toady
Jan 12, 2009

people trot that quote out to dismiss legit problems in their pet language. it's completely reasonable to discuss those issues because a programming language is a user interface for programming

Adbot
ADBOT LOVES YOU

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Toady posted:

lua "arrays" suck because you can insert nil into them and create a gap which fucks up a bunch of things including the value returned by the length operator. combine that with silently returning nil for undefined element and variable accesses and it's fun times

don't mention any of this on the lua mailing list because the people there declare the language to be perfect

are you saying [1,2,3,nil,5] has a length of 4? because that sounds nuts

double sulk
Jul 2, 2010

http://divshot.github.io/geo-bootstrap/

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

so loud it hurt my earballs

Toady
Jan 12, 2009

ultramiraculous posted:

are you saying [1,2,3,nil,5] has a length of 4? because that sounds nuts

iirc it has a length of 3. sparse arrays have their uses, but combined with typos silently returning nil, you can end up with bugs that propagate far from their origin. because of this and other issues, lua isn't designed well for writing large codebases

google's street view team had to write their own stack analyzer because:

Google lua-checker page posted:

* Referencing a variable that has not been declared will return nil. This is no different from referencing a 'declared' variable that has the value nil. Thus spelling mistakes in Lua variable names can go undetected and lead to program misbehavior.

* Tables (Lua's main data structure) are not typed, so any table can contain any keys. When tables are used in a manner similar to C structures, spelling mistakes in field names can go undetected and lead to program misbehavior.

* Function arguments and return values are also untyped and have similar problems.

In practice, Lua programs over (say) 1000 lines tend to accumulate these kinds of problems, making debugging difficult. A standard Lua practice to deal with undefined global variables is to install a special 'get-value' handler on the global variable table that warns when undefined globals are accessed. This is of limited benefit because problems are still only detected at run-time.

Cybernetic Vermin
Apr 18, 2005

ultramiraculous posted:

are you saying [1,2,3,nil,5] has a length of 4? because that sounds nuts

he is saying that the table with keys 1,2,3 and 5 has four keys, and you can unset a key by assigning the value nil. you can argue that lua should have "normal" arrays as well, but it does not, it instead uses a usage patter convention for situations where one would normally use arrays

Toady
Jan 12, 2009

Cybernetic Vermin posted:

he is saying that the table with keys 1,2,3 and 5 has four keys, and you can unset a key by assigning the value nil. you can argue that lua should have "normal" arrays as well, but it does not, it instead uses a usage patter convention for situations where one would normally use arrays

i'm saying lua's length operator (#) stops counting at the element before nil (other functionality get messed up as well), so if a nil gets in by accident, you'll have hard-to-debug misbehavior. all of this occurs silently with no warnings from lua

Opinion Haver
Apr 9, 2007

according to the language spec the length of #{1,2,3,nil,5} can either be 3 or 5:

quote:

If the array has "holes" (that is, nil values between other non-nil values), then #t can be any of the indices that directly precedes a nil value (that is, it may consider any such nil value as the end of the array).

amazing

lua 5.2 prints 5 for #{1,2,3,nil,5} but like i said that's not reliable

Opinion Haver fucked around with this message at 20:32 on Apr 7, 2013

Cybernetic Vermin
Apr 18, 2005

ah, right, got that wrong. don't know lua terribly well. overall i sort of agree on this end, arrays are too fundamental to fully leave out, a foolish consistency is the hobgoblin and all that.

otoh a good array and table implementation is all a language really needs as far as datatypes go, and lua seems to get the table more right than most among the p's.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

quote:

In practice, Lua programs over (say) 1000 lines tend to accumulate these kinds of problems, making debugging difficult.

stop plagiarizing my feelings about python, google

Toady
Jan 12, 2009

quote:

i'm shocked, shocked that they're sick and tired of smuglords telling them things they already about their language

lua only got popular because it was fast for videogames. a group of fans emerged along the way that thinks it's beautiful and perfect because you have to build everything by hand with tables, and anything more is "overdesigning" the language. the only person in that community who is critical of anything is mike pall of luajit, who called 5.2 the "vista of lua releases"

Opinion Haver
Apr 9, 2007

apparently i was reading an old spec

the new spec says that the length of {1,2,3,nil,5} is undefined:

quote:

Unless a __len metamethod is given, the length of a table t is only defined if the table is a sequence, that is, the set of its positive numeric keys is equal to {1..n} for some integer n. In that case, n is its length. Note that a table like

{10, 20, nil, 40}
is not a sequence, because it has the key 4 but does not have the key 3. (So, there is no n such that the set {1..n} is equal to the set of positive numeric keys of that table.) Note, however, that non-numeric keys do not interfere with whether a table is a sequence.

good job

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>
several pages of luachat :yaycloud:

double sulk
Jul 2, 2010

is LUA the right language for me????

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

gucci void main posted:

is LUA the right language for me????

probably not

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Vanadium posted:

I don't mind lua but this is absolutely true.
only beacuse working with too many c-derived languages has messed up your brain

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>
it's nice that people are finally posting actual problems with lua instead of their braindead inability to cope with 1-based indexing. thank you.

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
unix shell scripts require "then" and i never forget it

great language btw, like APL except readable (and slow)

Condiv
May 7, 2008

Sorry to undo the effort of paying a domestic abuser $10 to own this poster, but I am going to lose my dang mind if I keep seeing multiple posters who appear to be Baloogan.

With love,
a mod


yaoi prophet posted:

apparently i was reading an old spec

the new spec says that the length of {1,2,3,nil,5} is undefined:


good job

cowboy beepboop
Feb 24, 2001

Gazpacho posted:

unix shell scripts require "then" and i never forget it

great language btw, like APL except readable (and slow)

fi

Zaxxon
Feb 14, 2004

Wir Tanzen Mekanik

ultramiraculous posted:

are you saying [1,2,3,nil,5] has a length of 4? because that sounds nuts

nope, that has length 5 and will return 5 if you use the length operator.

To be more clear the literal {1,2,3,nil,5} will have length 5.

however you can screw it up by doing x = {1,2,3,4,5} x[4] = nil. That will come back with length 3. It is an annoying aspect of tables.

Zaxxon fucked around with this message at 23:30 on Apr 7, 2013

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

Zaxxon posted:

nope, that has length 5 and will return 5 if you use the length operator.

not in 5.1

skeevy achievements
Feb 25, 2008

by merry exmarx
remember when lua people managed to convince c/c++ guys that it would be a good idea to embed lua in their applications and let less talented developers write the business rules while ignoring the infrastructure

is that myth still alive

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

Internaut! posted:

remember when lua people managed to convince c/c++ guys that it would be a good idea to embed lua in their applications and let less talented developers write the business rules while ignoring the infrastructure

is that myth still alive

what in the name of gently caress are you talking about

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
nah unix shell awesomeness is unconditional, it's the only language that gives me the rush that basic on the ol c64 did

skeevy achievements
Feb 25, 2008

by merry exmarx

vapid cutlery posted:

what in the name of gently caress are you talking about

4m results



why pretend you havent heard of this thing that is basically the only reason for lua's "relevance" here in tyool 2013

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

Internaut! posted:

4m results



why pretend you havent heard of this thing that is basically the only reason for lua's "relevance" here in tyool 2013

I'm talking specifically about your weird argument re: "less talented" developers and "business logic"

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde
i thought it was mainly wow hackers bringing their hobbies into the office with them, and any engineering justification was merely a political cover

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

Gazpacho posted:

i thought it was mainly wow hackers bringing their hobbies into the office with them, and any engineering justification was merely a political cover

It was being used in games years before wow

GameCube
Nov 21, 2006

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

Hmm wonder why that's in there. Rip lucasarts

GameCube
Nov 21, 2006

used to be the SCUMM (Script Creation Utility for Maniac Mansion) bar but they switched to lua for grim fandango

unless ur being sarcastic in which case yep beats me

Nomnom Cookie
Aug 30, 2009



Internaut! posted:

remember when lua people managed to convince c/c++ guys that it would be a good idea to embed lua in their applications and let less talented developers write the business rules while ignoring the infrastructure

is that myth still alive

sure why not. it's better than letting the poo poo devs use a compiler

tef
May 30, 2004

-> some l-system crap ->

Nomnom Cookie posted:

sure why not. it's better than letting the poo poo devs use a compiler


fwiw: carmack came out and said scripting languages were a mistake for games. nothing is improved by having more lovely code by lovely devs. i.e if you're 'dumbing down' so that people who aren't programmers can write game logic, devs spend more time fixing it.

c.f business rules :v:

HORATIO HORNBLOWER
Sep 21, 2002

no ambition,
no talent,
no chance

Internaut! posted:

let less talented developers write the business rules while ignoring the infrastructure

is that myth still alive
the oldest myth

truly there is nothing new under the sun

coaxmetal
Oct 21, 2010

I flamed me own dad
so wait are lua arrays cstrings

MeruFM
Jul 27, 2010
the anti-scripting language for normals to write code is like the "REAL ENGINEERS" argument against software devs, except even less valid

but sperg elitism is nothing new, so the notion will always persist

Catalyst-proof
May 11, 2011

better waste some time with you

oh yeah I forgot about how lua killed the greatest adventure series of all time

gently caress lua

Adbot
ADBOT LOVES YOU

Cybernetic Vermin
Apr 18, 2005

as we all know the quality of games is all about the programming, programmers are the rulers and backbone of the game development process, with a court of loyal, but unfortunately stupid, artists, designers and writers

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply