lua-users home
lua-l archive

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


This is verbatim from the wiki.

(function()
  local require = require
  local print = print
  local module = module
  module("yourmodule");

  (function() module("mymodule") end)()

  print(mymodule ~= nil) -- prints false (where is it?)
end)();

print(mymodule ~= nil) -- prints true (where did this come from?)

I ran it on 5.2 and got this output

false
Lua: Error while running chunk
E:\lua\test.lua:12: attempt to call global 'print' (a nil value)
stack traceback:
E:\lua\test.lua:12: in main chunk

Lua: Error while running chunk

Does this run as published on 5.1?
If so is "module" different on 5.2?

Andre