lua-users home
lua-l archive

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


Luiz Henrique de Figueiredo wrote:

>I've updated my pdf library to Lua 5.0 and PDFlib 5.0.1:

Very nice pdflib binding. Incidentally, it binds well with the PDFlib 
Lite source code library as well as the full version.

Is there a reason the following metatable assignments are performed 
in pdf.lua rather than lpdf.c?

  pdf.metatable.__index=pdf
  pdf.metatable.__tostring=pdf.tostring

It seems more natural to place this in the library itself following 
the "__gc" assignment:

 lua_pushliteral(L, "__index");
 lua_pushvalue(L, 1);
 lua_settable(L,-3);
 lua_pushliteral(L, "__tostring");
 lua_pushcfunction(L, Ltostring);
 lua_settable(L,-3);
 lua_settable(L,-3);

Kurt Jung