int luaopen_img(lua_State * L) { preset_environment(L, img_parms, IMG_ENV); luaL_newmetatable(L, TYPE_IMG); luaL_register(L, NULL, img_m); luaL_newmetatable(L, TYPE_IMG_DICT); luaL_register(L, NULL, img_dict_m); luaL_register(L, "img", imglib); return 1; }
int luaopen_pdf(lua_State * L) { preset_environment(L, pdf_parms, PDF_ENV); luaL_register(L, "pdf", pdflib); /* build meta table */ luaL_newmetatable(L, "pdf_meta"); lua_pushstring(L, "__index"); lua_pushcfunction(L, getpdf); /* do these later, NYI */ lua_settable(L, -3); lua_pushstring(L, "__newindex"); lua_pushcfunction(L, setpdf); lua_settable(L, -3); lua_setmetatable(L, -2); /* meta to itself */ return 1; }
int luaopen_img(lua_State * L) { preset_environment(L, img_parms, IMG_ENV); luaL_newmetatable(L, TYPE_IMG); #ifdef LuajitTeX luaL_register(L, NULL, img_m); luaL_newmetatable(L, TYPE_IMG_DICT); luaL_register(L, NULL, img_dict_m); luaL_register(L, "img", imglib_f); #else luaL_setfuncs(L, img_m, 0); luaL_newmetatable(L, TYPE_IMG_DICT); luaL_setfuncs(L, img_dict_m, 0); luaL_newlib(L, imglib_f); #endif return 1; }