# Loops See [integer loops docs](https://www.lua.org/pil/4.3.4.html) ```lua for var=exp1,exp2,exp3 do something end -- find a value in a list local found = nil for i=1,a.n do if a[i] == value then found = i -- save value of `i' break end end print(found) ``` # Functions As Variables ```lua function a(x) print(x) end function b(x) print(x..x) end -- functions can be passed as variables function comb(f,g) f("world") g("flibble") end a("hello1") b("hello2") comb(a,b) --[[ outputs hello hellohello world flibbleflibble --]] ``` # Integer String Conversion ```lua tostring(42) tonumber("42") ``` # String formatting ```lua a = string.format("%03d",42) ```