[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: code organization
- From: steve donovan <steve.j.donovan@...>
- Date: Fri, 30 Aug 2013 08:33:42 +0200
On Fri, Aug 30, 2013 at 7:41 AM, Philipp Kraus
> In C++ I use namespaces and each namespace is mapped to a directory in the filesystem. Can I create anything similar with Lua?
Lua's module system is hierarchical, and directly related to the
So if $LUA is where your modules usually sit, then $LUA/libs/mine.lua
will be accessible with require 'libs.mine'. This gives your modules a
(hopefully unqiue!) namespace or 'package' libs.
It's common to put larger classes each in their own module, and then
require 'libs.klass' will usually return the 'constructor' for the