Jump to content


Photo

Lua Sucks!


  • Please log in to reply
5 replies to this topic

#1 JSLover

JSLover
  • Members
  • 920 posts

Posted 17 September 2012 - 07:19 PM

Why does Lua suck?

[*:9zdd9mfh]Because it's a stict-ass MF, which makes it so you can't debug code easily...

I'm trying to edit youtube.lua (from VLC, which unfortunately uses Lua, ugh!). The code is failing, so I'm trying to find out why. I NEED to see the value of vars at different points in the script, to find out why it's failing, so I write this...

vlc.msg.info('youtube.lua debug - return 1 - path('..path..')')
...& I get an error msg...

attempt to concatenate global 'path' (a nil value)

...I'm only trying to concatenate "a nil value" cuz the earlier code is failing & setting path to nil, why can't it just tell me the value is nil...by using my debug code, instead of bombing out?

So then I write this UGLY ASS code to workaround Lua being a dumbass...

if path==nil then
			path_disp='nil'
		else
			path_disp='yay'
		end

		vlc.msg.info('youtube.lua debug - return 1 - path('..path_disp..')')
...I have to invent a new var, just so I can output 'nil', when it's nil.

Note: If you have an alternate solution to this problem, plz post it! -- How do I output ANY VAR, regardless of what its value might be? -- this means output nil if it's nil / don't complain that you can't output nil.[/list]

[*:9zdd9mfh]if then end (aka: not using braces for blocks) is retarded: you can't easily find the end of the block...but with braces, you can.


[*:9zdd9mfh]Not having != is retarded: I can easily do ==, but I forget every time what Lua changed != into!


[*:9zdd9mfh]Not having ++ & += is retarded: there's just NO REASON to not have them! (dumb Lua wants: var=var+1)


[*:9zdd9mfh]Using .. for concatenation is annoying: + (plus) works perfectly fine for concatenation AND adding (in JavaScript).


[*:9zdd9mfh]Using nil instead of null: I mean, just, WTF?, come on...why?[/list]
Basically, there is NOTHING about Lua that makes sense or is good.

Bottom line: If I could avoid writing in Lua, I would. As a language, it just sucks. But it's embedded in VLC, so I must use it. I just wish VLC would embed AutoHotkey or JavaScript...then I could use a REAL language! -- & get stuff done, instead of fighting with STUPID error msgs -- "errors" that are not even errors! -- they are only "errors" cuz the language wants to be strict & act like they are problems worth complaining about, when they are not.

#2 tank

tank
  • Members
  • 4108 posts

Posted 18 September 2012 - 12:26 AM

Been a while since I looked at lua but I think you have to instantiate each variable with a value to avoid

#3 zzzooo10

zzzooo10
  • Members
  • 236 posts

Posted 22 September 2012 - 02:08 AM

Why not use tostring?
And I don't know how someone could hate lua, I find it to be enjoyable.

#4 ipotttt

ipotttt
  • Guests

Posted 04 October 2012 - 05:51 PM

yo lua is an awszum prog lang and i luv it

#5 UberiAsGuest

UberiAsGuest
  • Guests

Posted 23 October 2012 - 05:05 PM

Design decisions are made for a reason. It seems like your needs are rather different from those of the Lua creators. For instance, ~= means "not equals" just as much as "!=" does. After all, ~ and ! both mean NOT in a lot of C-like languages.

Lua names things differently because it has different design goals in mind; nil is not a null pointer, as you imply, but rather an absence of a value. Keywords are used instead of block braces because they are also used for table literals, and this can confuse people new to programming (I know it did for me when I was first using it in AHK_L), as well as the fact that they read like English (a decent editor will allow you to fold code just like any other language). I mention these because they are conscious design decision to cater to a niche that probably does not include the author of the first post.

In conclusion, it might not be right for one person, but that doesn't mean it is without merit for another. Lua isn't the be-all end-all language - no language is.

#6 gamax92

gamax92
  • Members
  • 410 posts

Posted 26 November 2012 - 04:07 AM

Lua is used in many programs because its cross compatable with different operating systems, its lightweight, and easy to embed/use.
Autohotkey is Windows only, is not embedable, definatly not lightweight, and is sometimes not easy to use.

[*:9zdd9mfh]if then end (aka: not using braces for blocks) is retarded: you can't easily find the end of the block...but with braces, you can.
This is what indentation is for, for example:

    blah blah blah
    if apple == "cheese" then
        blah blah blah
    end
    blah blah blah

I do agree with the fact that lua doesn't have a ++/-- or +=/-=