[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Partial execution of Lua function from C/C++ program?
- From: Peter Shook <pshook@...>
- Date: Tue, 24 Jun 2003 13:14:39 -0400
Bob Smith wrote:
Yeah I get the result of the function but I also get the result of
everything else not inside the function. So if I had 10 io.write
statements outside functions, I would get those outputed as well as the
execution of the function. Is this an expected result?
Yes. Anything not enclosed in a function is executed. Actually even
the function defitions are "executed", but all they do is set global or
local function variables so that you may call them later.
Every scripting language I've ever used works like this, so I'm not sure
what else you would expect.
You can do tricks with loadfile if you don't want it to run right away.
But you will have to run the whole thing if you want to call any of
the functions. The other option is to separate out what you don't want.
- Peter Shook