lua-users home
lua-l archive

Re: silent hang - can anyone explain?

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


On 16 October 2012 16:12, David Collier <myshkin@cix.co.uk> wrote:
> I mistakenly wrote:
>
> for charIndex = startIndex, #payLoad
> do
> local char = payLoad:subs(charIndex, charIndex)
>
> of course it should have been sub()
>
> my program silently hung - is this an expected consequence of this sort
> of misspelling?
 Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
 > mystring = "Hello world"
 > return mystring:subs(1,1)
 stdin:1: attempt to call method 'subs' (a nil value)
 stack traceback:
 	stdin:1: in main chunk
 	[C]: ?
I'll make a guess that you're using Lua inside an application that is
using [lua_]pcall() without appropriate error handling in place to
report the error to you. Another possibility is that the error
happened inside a coroutine, you need to check the return value from
coroutine.resume() in this case.
Regards,
Matthew

AltStyle によって変換されたページ (->オリジナル) /