lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On 17 December 2014 at 12:34, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
I have a quick quiz for this
list. Without running the code, what are the results of the following
expressions in Lua 5.2?

  string.rep("a", 2.7)
  string.format("%d", 2.7)
  string.rep("a", 2.3)
  string.format("%d", 2.3)

IIRC, in practice, lua always rounds down. so:

aa
2
aa
2