lua-users home
lua-l archive

Re: Evaluating files...

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


> ...Is it
> possible to evaluate a file before attempting to run it (such as the -c
> argument with perl)? In other words, can I check that it is
> syntactically correct in any way other than actual execution of the
> code.
Try:
 local chunk, err = loadfile("myfile.lua")
 if chunk then
 print("All's well")
 else
 print("error in file: " .. err)
 end
--
Wim

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