lua-users home
lua-l archive

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


Just looked at the source code of luasocket, it doesn't set any global, make sure you do local luasocket = require("luasocket").
On 16 Jan 2021, 19:40 +0300, Robert Burke <sharpobject@gmail.com>, wrote:
On Sun, Jan 17, 2021 at 1:33 AM DarkWiiPlayer <darkwiiplayer@hotmail.com> wrote:
The move to lua files returning the "module" so they exist purely as
locals where they're required is exemplary of one of the biggest
differences in design philosophy between Lua and Ruby (the other
language I (am forced to) use), where you require something and it just
dumps all of its constants and classes into your global environment
(usually they are at least namespaced into a single module, but still, ugh).

In Lua I cannot require luasocket or lpeg without any globals being set :(