lua-users home
lua-l archive

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

On 16 Jun 2007, at 4:26 , Luiz Henrique de Figueiredo wrote:

  local Result = false;  -- you could also use "nil" here
    Result = Result or "anything else";
  io.stdout:write("Result = '"..tostring(Result).."'");

yields "false" (or "nil", resp.) rather than "anything else"

Perhaps this is related to this bug, which apparently only surfaces in

This could well be the case. The following works fine on OSX

gResult = false or "anything else";
io.stdout:write("gResult = '"..tostring(gResult).."'\n");

local lResult = false or "anything else";
io.stdout:write("lResult = '"..tostring(lResult).."'\n");

local xResult = false;
local tResult = xResult or "anything else";
io.stdout:write("tResult = '"..tostring(tResult).."'\n");


gResult = 'anything else'
lResult = 'anything else'
tResult = 'anything else'

For Lua 5.1.2  Copyright (C) 1994-2007, PUC-Rio

Genius has its limitations. Stupidity is not thus handicapped.