lua-users home
lua-l archive

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


On 19 February 2017 at 20:09, Daurnimator <quae@daurnimator.com> wrote:
> On 19 February 2017 at 18:06, Daurnimator <quae@daurnimator.com> wrote:
>> e.g. a module that registers a metatable with `luaL_setmetatable`
>> inside of it's `luaopen_` function.
>
> Oops, I meant luaL_newmetatable here.

And now reading the docs
(http://www.lua.org/manual/5.3/manual.html#luaL_newmetatable) I
noticed that luaL_newmetatable *doesn't* do anything if the key
already exists.
This is slightly better for the reloading situation: it means that
things won't break as I mentioned earlier with luaL_checkudata.