Language LUA
(version 5.x)
Date: | 07/10/05 |
Author: | chill |
URL: | n/a |
Comments: | 2 |
Info: | n/a |
Score: | (2.13 in 30 votes) |
--LUA 5.x by CHILL CODE -- for X = 99 to 2 -- X Bottles of beer on the wall, X bottles of beer. -- Take one down and pass it around, [X-1] bottles of beer on the wall. -- for X = 1 -- X Bottles of beer on the wall, X bottles of beer. -- Take one down and pass it around, no more bottles of beer on the wall. -- for X = 0 -- No more bottle of beer on the wall. No more bottles of beer... -- Go to the store and buy some more...99 bottles of beer. for i = 99, 2 do write( i.." Bottles of beer on the wall, "..i.." bottles of beer." ) write( "Take one down and pass it around, "..(i-1).." bottles of beer on the wall." ) end write( "1 Bottles of beer on the wall, 1 bottles of beer." ) write( "Take one down and pass it around, no more bottles of beer on the wall." ) write( "No more bottle of beer on the wall. No more bottles of beer... " ) write( "Go to the store and buy some more...99 bottles of beer." )
Download Source | Write Comment
Alternative Versions
Version | Author | Date | Comments | Rate |
---|---|---|---|---|
original version | Philippe Lhoste | 04/20/05 | 1 | |
5.1, bottled | Peter Cawley | 04/19/09 | 0 | |
Examples of metatables in lua 5.1 | Peter Cawley | 06/07/07 | 0 |
Download Source | Write Comment
Add Comment
Please provide a value for the fields Name,
Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.
Please don't post large portions of code here! Use the form to submit new examples or updates instead!
Comments
Space man said on 02/06/07 21:24:10
Not really a good lua code. :p
Jack Leunissen said on 03/23/07 00:32:14
The "for" statement should actually read "for i = 99, 2, -1 do" in order to work. As it is now, it will never enter the loop.