lua-users home
lua-l archive

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

2014-07-31 17:40 GMT+02:00 Daurnimator <>:
> On 31 July 2014 01:23, Dirk Laurie <> wrote:
>> What I have done in some of my modules is to make them
>> return two values. Then `require "mymod"` only accesses the
>> public part, but `mymod, private = dofile"mymod.lua"` also
>> returns a table containing some local functions, cached
>> while they were visible. Then `lunit` or a similar tool can test
>> `mymod`, and some special-purpose tool that I have control
>> over can test `private`.
> Love it. How did you stumble across this idea? :)

If you edit code, and test it in the interactive shell at the
same time, `require` does not reload just because the
source code has changed, so I got in the habit of using
`dofile` instead.