[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How to display loadfile(scriptName) errors
- From: David Burgess <dburgess@...>
- Date: Sat, 10 Dec 2005 11:42:03 +1100
Try
local chunk, err = loadfile("./foo.lua");
assert(chunk,err);
On 12/10/05, Henderson, Michael D <michael.d.henderson@lmco.com> wrote:
> How can I retrieve any errors returned by loadfile? For example, if I
> run "foo" from the command line, lua returns a nice error message:
>
> $ lua ./foo.lua
> lua: ./foo.lua:6: function arguments expected near `='
>
> If I run it from loadfile, using
> local chunk = loadfile("./foo.lua");
> assert(chunk);
>
> All that I get back is "assertion failed!". I don't see how I can wrap
> pcall() around it, either.
>
> Thanks,
> Mike
>
> Okay, at this point you're abusing sarcasm.
> - Buffy the Vampire Slayer
>
>