lua-users home
lua-l archive

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


If you want to call require, then you can do so in C:
lua_getglobal(L, "require");
lua_pushliteral(L, "mymodule");
lua_call(L, 1, 1);

On Sat, Jul 25, 2009 at 9:30 AM, Lawrie Nichols<lawrien@gmail.com> wrote:
> I need to be able to load an existing lua C module from within a new C
> module (from within it's luaopen_xxx function). The obvious parallel is
> doing a 'require' in a lua script, but there doesn't (as far as I can find)
> appear to be an equivelent C API.
>
> I guess I could just do a lua_dostring(L,"require 'mymodule'"), but that
> doesn't smell quite right.
>
> Any ideas where I should look ?
>
> Many thanks, Lawrie
>