lua-users home
lua-l archive

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



On Sun, Jan 19, 2014 at 8:19 AM, Gaspard Bucher <gaspard@teti.ch> wrote:
extern "C" int luaopen_lui_core(lua_State *L) {
  lua_newtable(L);

Without debugging further: yes, this is how you "do it" in 5.2 (and it works for 5.1, too)

The important part is that you make a table and return it. The "old way" was to make a global table, or "module" when the user called `require("lui")`. The way you have it written, they need to do something like `local lui = require'lul'` and that's a good thing.


BTW: you can use `lua_setfield(L, -2, "Window");` instead of setting the field with `lua_pushstring`. Same result, less typing. :)

-Andrew