lua-users home
lua-l archive

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


Thank you, it works. :)

----- Original Message ----- 
From: "Matt Campbell" <mattc@freedombox.cc>
To: "Lua list" <lua@bazar2.conectiva.com.br>
Sent: Tuesday, August 22, 2006 10:47 AM
Subject: Re: Call which function to initialize the package.loadlib featuresin 5.1?


> Hello Jason:
> 
> It's easiest to open all of the standard libraries at once by calling 
> luaL_openlibs(L).  However, if you want to open the package library 
> individually, you can do it like this:
> 
>  lua_pushcfunction(L, luaopen_package);
>  lua_pushliteral(L, "package");
>  lua_call(L, 1, 0);
> 
> The statements above push luaopen_package as a C function on the Lua 
> stack, push the library name ("package") as an argument, and tell Lua to 
> call the function, not leaving any return values on the stack.  This is 
> the way that luaL_openlibs opens each of the standard libraries.
> 
> I hope this helps.
> 
> -- 
> Matt Campbell
> Lead Programmer
> Serotek Corporation
> www.freedombox.info
> "The Accessibility Anywhere People"
> 
>