On 21/02/17 01:30 AM, Derek Bailey wrote:
The 'true.lua' file still takes a non-zero and non-trivial
size on disk due to the inode structure.
(http://stackoverflow.com/questions/3618820/how-many-bytes-per-inodes
<http://stackoverflow.com/questions/3618820/how-many-bytes-per-inodes>)
Thus the following is smaller module with your same requirements:
package.loaded['true']=true
assert(require'true' == true)
Not saying what I have cannot be smaller, but don't make
absolute statements that aren't true.
And any non-empty Lua module file still takes more size on disk
than true.lua.
The point is to have it as a separate file/an external module, in
which case my statements are true.
My code isn't in a separate module file, it is defined directly in the
source Lua file that is using the module. Thus adding the ~28 bytes to
the source file is much less than the 1KB needed for a completely
separate, and empty, file. Your requirements didn't state that it had
to be a separate/external file, just that it is the smallest possible
Lua module, which isn't true.