lua-users home
lua-l archive

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


On 31/01/2013, at 9:46 PM, "Pierre Chapuis" <catwell@archlinux.us> wrote:

> In PiL 3 chapter 8 there is this exercise:
> 
>    "Can you find any value for f such that the call pcall(pcall,f)
> returns false as its first result?"


Does the absence of a value count?

$ lua
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> =pcall(pcall, (function() end)())
false	bad argument #1 to '?' (value expected)

pcall(pcall) also works, but then it's more obvious that I'm cheating and that f is not a value.