mirror of
https://github.com/lua/lua.git
synced 2026-07-26 16:09:07 +00:00
This is the first commit for the branch Lua 5.3. All source files were copied from the official distribution of 5.3.5 in the Lua site. The test files are the same of 5.3.4. The manual came from the previous RCS repository, revision 1.167.1.2.
24 lines
385 B
C
24 lines
385 B
C
#include "lua.h"
|
|
#include "lauxlib.h"
|
|
|
|
static int id (lua_State *L) {
|
|
return lua_gettop(L);
|
|
}
|
|
|
|
|
|
static const struct luaL_Reg funcs[] = {
|
|
{"id", id},
|
|
{NULL, NULL}
|
|
};
|
|
|
|
|
|
LUAMOD_API int luaopen_lib2 (lua_State *L) {
|
|
lua_settop(L, 2);
|
|
lua_setglobal(L, "y"); /* y gets 2nd parameter */
|
|
lua_setglobal(L, "x"); /* x gets 1st parameter */
|
|
luaL_newlib(L, funcs);
|
|
return 1;
|
|
}
|
|
|
|
|