lua-users home
lua-l archive

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


the attached script gives this output with various previous Lua

$ lua snip.lua
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
Hello World

$ lua snip.lua
Lua 5.2.0 (alpha)  Copyright (C) 1994-2010 Lua.org, PUC-Rio
Hello World

but with Lua 5.2.0 beta-rc1, the two lines are concatenated in one

$ lua snip.lua
Lua 5.2.0 (beta)  Copyright (C) 1994-2011 Lua.org, PUC-RioHello World
nil

François

local lua = arg[-1]

local f = io.open('hello.lua', 'w')
f:write([[
print 'Hello World'
]])
f:close()

local cmd = lua .. [[ -v hello.lua 2>&1]]
f = io.popen(cmd)
local line1 = f:read'*l'
print(line1)
-- assert(line1:sub(1,3) == 'Lua')
local line2 = f:read'*l'
print(line2)
-- assert(line2 == 'Hello World')
f:close()