Quantcast Programming: Lua Extensible Scripting Language - digitalFAQ.com Forums [Archives]
Go Back    digitalFAQ.com Forums [Archives] > Video Production Forums > Avisynth Scripting

Reply
 
LinkBack Thread Tools
  #1  
02-17-2003, 01:30 AM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
A wonderful scripting language from Brasil
A couple of years ago, I wrote an E-Mail parser to SMS (Short Message Cellular Systems) program with this scripting language. It's probably one of the fastest interpreters around. It blows away Perl, Python, Rebol, etc. So anyone interested in scripting, even embedding in Apache web servers as I believe there is now a MOD_LUA available, take a look here: www.lua.org
There are also GTK bindings and even some commercial games have been written with this. It runs on just about every platform

Here's some of the stuff available: http://lua-users.org/wiki/LuaAddons

-kwag
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Site Staff / Ad Manager
 
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
02-25-2003, 05:26 PM
SansGrip SansGrip is offline
Free Member
 
Join Date: Nov 2002
Location: Ontario, Canada
Posts: 1,135
Thanks: 0
Thanked 0 Times in 0 Posts
You'll have to rip perl out of my cold, dead fingers :P .
Reply With Quote
  #3  
02-25-2003, 05:38 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Perl "The language that includes the kitchen sink"
I never did get in too deep into Perl. It seems like the syntax is so terse, that if I came back to some of my own code a month later, I would probably need to decipher it
It's weird, because C is just as bad, but I guess it just rubbs in after using it for a long time. I must be brain damaged now, because I see some simpler languages around, and I can't seem to grasp some of the rules . So I guess I'll stick to C ( when necessary ) and Python for everything else

-kwag
Reply With Quote
  #4  
02-26-2003, 04:53 PM
SansGrip SansGrip is offline
Free Member
 
Join Date: Nov 2002
Location: Ontario, Canada
Posts: 1,135
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kwag
It seems like the syntax is so terse, that if I came back to some of my own code a month later, I would probably need to decipher it
That is the main problem with Perl. Because it's so idiomatic it does encourage clever shortcuts that don't seem so clever when you're trying to work out what your code does six months later. Another way of saying it is that it looks somewhat like line noise . But then, what other language can do something like this in one line:

Code:
print "'" . $_ . "' is a low-fat sausage.\n" foreach sort grep { /(lite|light)/ } @all_sausages;
That's either a good thing or a bad thing depending on your perspective .
Reply With Quote
  #5  
02-26-2003, 05:01 PM
rendalunit rendalunit is offline
Free Member
 
Join Date: Apr 2002
Location: san jose, Ca
Posts: 1,148
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by SansGrip
That's either a good thing or a bad thing depending on your perspective
i don't know what that line was intended to do but it made me hungry- I'm gonna go make a sausage sandwich
Reply With Quote
  #6  
02-26-2003, 05:22 PM
SansGrip SansGrip is offline
Free Member
 
Join Date: Nov 2002
Location: Ontario, Canada
Posts: 1,135
Thanks: 0
Thanked 0 Times in 0 Posts
Reply With Quote
  #7  
02-26-2003, 05:37 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by SansGrip
But then, what other language can do something like this in one line:

Code:
print "'" . $_ . "' is a low-fat sausage.\n" foreach sort grep { $_ =~ /(lite|light)/ } @all_sausages;
That's either a good thing or a bad thing depending on your perspective .
Python

Code:
sausages=["lite", "light"]; sausages.sort()
for x in sausages:
   print x, "is a low-fat sausage"
and faster too

-kwag
Reply With Quote
  #8  
02-26-2003, 05:59 PM
SansGrip SansGrip is offline
Free Member
 
Join Date: Nov 2002
Location: Ontario, Canada
Posts: 1,135
Thanks: 0
Thanked 0 Times in 0 Posts
[quote="kwag"]
Code:
sausages=["lite", "light"]; sausages.sort()
for x in sausages:
   print x, "is a low-fat sausage"
This isn't quite the same. Given a list of sausages such as:

my @all_sausages = (
"Bob's High-Fat Meat Tubes",
"Sausage-tastic",
"Sausage-tastic Lite",
"Cholesterol Delights"
);

that Perl code will first search the list for all entries matching the regular expression /(lite|light)/ and produce the following temporary list:

("Sausage-tastic Lite", "Cholesterol Delights")

It'll then sort the list and print the message for each entry in that new list.

Try that in one line with Python .

As for any speed difference, I've not seen any benchmarks of Perl vs. Python. The latter is a nice language (e.g. object-oriented by design) but I'd miss Perl's seamless handling of regexes if I were forced to swap .
Reply With Quote
  #9  
02-26-2003, 07:46 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Now you see, I got hungry and had to go get something to eat
Ok, I didn't pay attencion to the RegEx matching part /(lite|light)/.
It's very similar in python, but a little more readable in Python. I guess RegEx is not too readable, no matter what language it's used on
Anyway, here's a one liner, which is not mine. I got it off Python's site, related to what can actually be accomplished in one line. Copy and paste to a file, run it on a U*ix console and look at the output

Code:
# Mandelbrot set
        print (lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+y,map(lambda y,
        Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,Sy=Sy,L=lambda yc,Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,i=IM,
        Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro,
        i=i,Sx=Sx,F=lambda xc,yc,x,y,k,f=lambda xc,yc,x,y,k,f:(k<=0)or (x*x+y*y
        >=4.0) or 1+f(xc,yc,x*x-y*y+xc,2.0*x*y+yc,k-1,f):f(xc,yc,x,y,k,f):chr(
        64+F(Ru+x*(Ro-Ru)/Sx,yc,0,0,i)),range(Sx))):L(Iu+y*(Io-Iu)/Sy),range(Sy
        ))))(-2.1, 0.7, -1.2, 1.2, 30, 80, 24)
Yes, it is one line, and it does run

If you really love Perl, then I think you'll fall in love with Ruby
http://www.ruby-lang.org/en/
I've been reading about it lately.

-kwag
Reply With Quote
  #10  
02-27-2003, 08:22 AM
SansGrip SansGrip is offline
Free Member
 
Join Date: Nov 2002
Location: Ontario, Canada
Posts: 1,135
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by kwag
Code:
# Mandelbrot set
        print (lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+y,map(lambda y,
        Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,Sy=Sy,L=lambda yc,Iu=Iu,Io=Io,Ru=Ru,Ro=Ro,i=IM,
        Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro,
        i=i,Sx=Sx,F=lambda xc,yc,x,y,k,f=lambda xc,yc,x,y,k,f:(k<=0)or (x*x+y*y
        >=4.0) or 1+f(xc,yc,x*x-y*y+xc,2.0*x*y+yc,k-1,f):f(xc,yc,x,y,k,f):chr(
        64+F(Ru+x*(Ro-Ru)/Sx,yc,0,0,i)),range(Sx))):L(Iu+y*(Io-Iu)/Sy),range(Sy
        ))))(-2.1, 0.7, -1.2, 1.2, 30, 80, 24)
Just goes to show you can write unreadable code in any language if you're really determined .

Quote:
If you really love Perl, then I think you'll fall in love with Ruby
I've never looked at Ruby. One day when my todo list clears a little I'll get a book on it .
Reply With Quote
  #11  
02-27-2003, 12:11 PM
GFR GFR is offline
Free Member
 
Join Date: May 2002
Posts: 438
Thanks: 0
Thanked 0 Times in 0 Posts
Have you ever seen the "most obfuscated C code contest" page ?

Reply With Quote
  #12  
02-27-2003, 12:34 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by GFR
Have you ever seen the "most obfuscated C code contest" page ?

Oh yeah, it's a real brain twister
But if you want to see the most pathetic one in the world, you have to see this:

Code:
022p25*":ereh drow ruoy retnE">,# :# _>~:25*-#v_v>22g1+:98+-#v_v
                                      ^p3g22              p22<
  0                                           >  ^
***************** v                             <              <
    0             >22g1+22p>22g1-:22p#v_25*,@
     0
                           ^               p 3g55"*",<
                                      v                <
                                        >:55p3g:"*"-#^_^

                                      v ^  <
                               >94+   #    ^
                               v      <    ^
                               #  >5*    > ^
                                  2      6 ^
                              v?vv?v# ?#v?7^
                              999999  # 58 ^
                              76532   >1   ^
                              +++++  v?v   ^
                                     234   ^
                              >>>>>>>>>>>>>^
SICK :mgreen: SICK , but it's actually a programming language : Sample here: http://www.catseye.mb.ca/esoteric/be...src/anagram.bf
Page here: http://www.catseye.mb.ca/esoteric/befunge/

The designer of this "thing" must have been smoking weed ( one in each nostril ), and an opium pipe up his

Hey SansGrip, how about a new pixel anti "moire" pattern filter with this.

-kwag
Reply With Quote
  #13  
02-27-2003, 12:48 PM
muaddib muaddib is offline
Free Member
 
Join Date: Jun 2002
Location: São Paulo - Brasil
Posts: 879
Thanks: 0
Thanked 0 Times in 0 Posts
Oh man... I just can't believe it!
No way it's a programming language.
Please, tell me that's just a bunch of garbage/noise!!

I have to look that link...
But I think I'll not be convinced anyway
Reply With Quote
  #14  
02-27-2003, 12:58 PM
rendalunit rendalunit is offline
Free Member
 
Join Date: Apr 2002
Location: san jose, Ca
Posts: 1,148
Thanks: 0
Thanked 0 Times in 0 Posts
look at this program
Code:
92+9*                           :. v  <
>v"bottles of beer on the wall"+910<
,:
^_ $                             :.v
            >v"bottles of beer"+910<
            ,:
            ^_ $                     v
>v"Take one down, pass it around"+910<
,:
^_ $                           1-v
                                 :
        >v"bottles of beer"+910.:_          v
        ,:
        ^_ $                          ^
                    >v" no more beer..."+910<
                    ,:
                    ^_ $$ @
and my favorite quote:
"Maybe the language isn't that useful, but it's nifty and fun."
-- Matthew Moss
Reply With Quote
  #15  
02-27-2003, 01:44 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by rendalunit
look at this program
Code:
92+9*                           :. v  <
>v"bottles of beer on the wall"+910<
,:
^_ $                             :.v
            >v"bottles of beer"+910<
            ,:
            ^_ $                     v
>v"Take one down, pass it around"+910<
,:
^_ $                           1-v
                                 :
        >v"bottles of beer"+910.:_          v
        ,:
        ^_ $                          ^
                    >v" no more beer..."+910<
                    ,:
                    ^_ $$ @
and my favorite quote:
"Maybe the language isn't that useful, but it's nifty and fun."
-- Matthew Moss
Nifty and fun "My A*

I might as well use an abacus

-kwag
Reply With Quote
  #16  
02-27-2003, 01:52 PM
kwag kwag is offline
Free Member
 
Join Date: Apr 2002
Location: Puerto Rico, USA
Posts: 13,537
Thanks: 0
Thanked 0 Times in 0 Posts
LMAOROTF
Some people are sick look at this one: http://www.winterbergs.de/software/zte.htm
And with a quote like this: "The ZT programming language is quite romantic" HAHAHA

-kwag
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
More language packs of Windows XP SP2 jorel Computers 7 09-01-2004 01:43 PM
English Language glänzend Off-topic Lounge 1 06-02-2004 10:52 AM
do I need to use scripting to use KDVD? gidxg03 Video Encoding and Conversion 1 10-24-2003 11:53 AM
how and where to activate the movie subtitle language? ezysk Subtitles 4 07-16-2003 06:11 PM
KVCD: Where to encode the second language? plautzer Video Encoding and Conversion 7 07-14-2003 01:31 AM




 
All times are GMT -5. The time now is 12:05 AM  —  vBulletin © Jelsoft Enterprises Ltd