
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" lua - standalone interpreter and interactive shell.Usually, Lua is being shipped with two binaries: To active the second chunk while disabling the first chunk, delete the leading - on the first line: -[[
Lua script in fastoredis code#
Taking this a step further, two blocks of code can be setup in such a way that if the first block is commented out the second won't be, and visa versa: -[[ This way, the sequence - in the first line starts a single-line comment, just like the last line, and the print statement is not commented out. To reactivate the chunk, simply append a - to the comment opening sequence: -[[ Single-line comments in Lua start with - and continue until the end of line: - this is single line commentīlock comments start with -] : - : -[[

Module system revamp, incremental garbage collector, metatables for all types, luaconf.h revamp, fully reentrant parser, variadic arguments.Įmergency garbage collector, goto, finalizers for tables.īasic UTF-8 support, bitwise ops, 32/64bit integers.
Lua script in fastoredis full#
Multiple states, "for" statements, API revamp.Ĭoroutines, metatables, full lexical scoping, tail calls, booleans move to MIT license. Introduced auxlib, a library for helping writing Lua librariesĪnonymous functions and function closures via "upvalues". Long strings, the debug interface, better stack tracebacks Starting with Lua 2.1, Lua became freely available for all purposes, including commercial uses.
