lua-users home
lua-l archive

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


> Is there an easy way for a Lua script to determine whether  it was
> launched directly from the interpreter/host program or it was required
> into a another script?

See this discussion for several options and their pros/cons
(http://lua.2524044.n2.nabble.com/Modules-with-standalone-main-program-td7681497.html)
and this SO answer
(https://stackoverflow.com/questions/49375638/how-to-determine-whether-my-code-is-running-in-a-lua-module).

Paul.

On Tue, Feb 9, 2021 at 10:20 AM Michael Nelson <mikestar1313@gmail.com> wrote:
>
> Is there an easy way for a Lua script to determine whether  it was
> launched directly from the interpreter/host program or it was required
> into a another script?
>