![]() You can compile the program into Lua's bytecode by executing following on Your shell: $ luac bottles_of_a -o bottles_of_acĪlso bytecode listing is available by executing following: $ luac -l bottles_of_a Get some from the store, 99 bottles of mate on the wall. Take one down, pass it around, 0 bottles of mate on the wall. Take one down, pass it around, 1 bottles of mate on the wall. Take one down, pass it around, 2 bottles of mate on the wall. ![]() Take one down, pass it around, 97 bottles of mate on the wall. Take one down, pass it around, 98 bottles of mate on the wall. Output should look like this, running in the endless loop: Get some from the store, 99 bottles of mate on the wall. The program itself can be ran by executing following on Your shell: $ lua bottles_of_a Print(string.format(buy_str, bottles_left)) Print(string.format(end_str, bottles_available)) Print(string.format(take_str, bottles_left)) Print(string.format(count_str, bottles_available)) Local buy_str = "Get some from the store, ". ![]() Local take_str = "Take one down, pass it around, ". Local count_str = "%d bottles of mate on the wall." Lets say we have an example program ( bottles_of_a ) like this: local string = require "string"
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |