lua-users home
lua-l archive

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


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
>
>