lua-users home
lua-l archive

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


On Mon, Sep 14, 2020 at 9:10 AM Александр Машин <traditio.ru@gmail.com> wrote:

> is there a C in Lua distribution function that does this?

I think your code is equivalent to the following Lua code:

_ENV[global] = package.loadlib(path, 'luaopen_' .. global)()

Then again, it is not clear why this should not just be:

_ENV[global] = require(global)

There are several ways to execute Lua code from a C host, for example,
luaL_dostring().

Cheers,
V.