lua-users home
lua-l archive

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


> When you create a new userdata by calling lua_newuserdata() the
> newly created userdata gets a default environment table installed
> which turns out to be ... wait for it ... the global `package' table
> :-|. I don't consider this useful behaviour and I couldn't find any
> mention of it in the Lua 5.1 reference manual (please correct me if
> I'm wrong).

>From the manual, section 2.9 ("Environments"):
  http://www.lua.org/manual/5.1/manual.html#2.9

  "Userdata and C functions are created sharing the environment of the
  creating C function."

If the environment of the function that is creating the userdata is
not the global 'package' table, please report a bug.

-- Roberto