lua-users home
lua-l archive

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


Aleksey Cheusov wrote:
[...]
> I'd like to somehow separate (visually) code in a module into two
> sections: export (list of exported functions, variables etc.) and
> implementation (internals that should not be used outside this
> module).  Is there naming conventions for this in Lua?

That's normally done by scoping; internal functions are defined as local
variables rather than as module members.

local function internalfn(...)
end

function externalfn(...)
  internalfn(...)
end

This also has the advantage of being faster and using less memory, too.

-- 
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│ "A line dancer near a graduated cylinder, the blithe spirit inside
│ some wheelbarrow, and a tomato are what made America great!" ---
│ received via spam

Attachment: signature.asc
Description: OpenPGP digital signature