[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: PiL 3 and pcall
- From: Geoff Leyland <geoff_leyland@...>
- Date: Thu, 31 Jan 2013 21:58:55 +1300
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.