lua-users home
lua-l archive

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


On Wed, Jan 11, 2017 at 8:54 PM, Roberto Ierusalimschy
<roberto@inf.puc-rio.br> wrote:
> Exactly how 'functions' is defined?

functions is a const luaL_Reg *functions

==
static const struct luaL_Reg buffer_functions[] = {
  { "new", buffer_new },
  { NULL, NULL }
};

register_class(L, "harfbuzz.Buffer", buffer_methods, buffer_functions);
==

and register class is defined as:

==
int register_class(lua_State *L, const char *name, const luaL_Reg *
methods, const luaL_Reg *functions) {
…
…
 luaL_newlib(L, functions);
}
==

I hope that is clear. The original code is located here:
https://github.com/deepakjois/luaharfbuzz/blob/master/src/luaharfbuzz/class_utils.c#L4