[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Evaluating files...
- From: Matthew Percival <matthew@...>
- Date: Tue, 26 Jul 2005 15:59:07 +1000
G'Day,
I just have a simple little question in regard to lua files. 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. As an example of what I am thinking:
if (os.execute("evaluate-lua myfile.lua"))
dofile("myfile.lua")
else
io.stdout:write("myfile.lua is invalid")
end
I know that particular condition would not quite fit what I am
suggesting, but it is just to get the gist of the idea across.
I am wanting to load lua tables in files, but have been caught out a
couple of times by manually editing those files and missing brackets or
whatnot: when I next execute a script that uses these tables, it will
die on me. If I could check first and more cleanly handle failure, then
I would definitely take advantage of it.
-- Matthew