Programming in Lua - 5.1
Programming in Lua - 5.1
Programming in Lua
Part I. The Language
Chapter 5. Functions
print(s, e) --> 7 9
mi = i
m = val
end
end
return m, mi
end
print(maximum({8,10,23,12,5})) --> 23 3
When a function call is the last (or the only) argument to another call,
all
results from the first call go as arguments.
We have seen examples of this
construction already,
with print:
print(foo0()) -->
print(foo1()) --> a
print(foo2()) --> a b
print(foo2(), 1) --> a 1
a = {foo1()} -- a = {'a'}
end
end
print(foo(1)) --> a
print(foo(2)) --> a b
print((foo1())) --> a
print((foo2())) --> a
print(unpack{10,20,30}) --> 10 20 30
f = string.find
a = {"hello", "ll"}
i = i or 1
end
end