lua-users home
lua-l archive

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


>I think Curt is right.  Preappending a "do return end" will skip all of my
>function definitions.  Hmmm, so I guess I am back to my original problem.
>How do I load the compiled source and definitions without execution.

Can you put "do return end" just after the function definitions?

If not, can the files be written as follows?

<function definitions>

return function ()
 <"executable" code here>
end

If so, then lua_dofile on such files only defines the given functions
and returns an anonymous function that contains the "executable" code.
If you want to run this, simply call this function with lua_call(L,0,0).
If you don't want to run the "executable" code, simply lua_pop(L,1).
--lhf