X Tutup
Skip to content

Commit 7b2770f

Browse files
committed
Format file with clang format rules
1 parent a50fe8b commit 7b2770f

File tree

1 file changed

+45
-45
lines changed

1 file changed

+45
-45
lines changed

src/lua/core/Import.cpp

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -24,42 +24,42 @@
2424
#endif
2525

2626
/**
27-
* We use Lua's require() functionality, but with a twist.
28-
*
29-
* When specifying a module name to `require()`, beginning the module name
30-
* with a separator (`.`) is syntactic sugar for prepending the source
31-
* directory of the calling file to the module name, forming a system of
32-
* relative name lookup.
33-
*
34-
* Relative name lookup cannot ascend levels in the filesystem, nor can it be
35-
* used to exit the virtual filesystem. It's merely a shorthand to implicitly
36-
* specify the module name of the calling file as a prefix to the module name
37-
* passed to `require()`. This is done as follows:
38-
*
39-
* -- when called from myname/modname/mod-load.lua
40-
* require '.module-A'
41-
* -- this call is transformed into:
42-
* require 'myname.modname.module-A'
43-
*
44-
* Once the full module name has been established, it is run through several
45-
* levels of lookup. First, the module name is tested against the import
46-
* cache, then against the list of modules registered by C++ code. Finally,
47-
* it is converted into a file path and tested against the filesystem to
48-
* load a lua file from disk.
49-
*
50-
* Filesystem lookup follows the usual rules; a file in a mod overrides files
51-
* earlier in the mod load order, and the overriden files cannot be loaded
52-
* from disk. If there is a C++ module with a specific name, it overrides all
53-
* Lua files with that name.
54-
*
55-
* The `package.core` object stores C++ modules for convenience. Access
56-
* is by standard Lua notation - `package.core.PiGui.Modules.ModelSpinner`
57-
* works just fine, as does `require 'PiGui.Modules.ModelSpinner'`.
58-
*
59-
* The `package.reimport(name)` function purges the cache for a specific
60-
* module name and repeats the loading process - useful for when a file
61-
* changes on disk as part of development.
62-
*/
27+
* We use Lua's require() functionality, but with a twist.
28+
*
29+
* When specifying a module name to `require()`, beginning the module name
30+
* with a separator (`.`) is syntactic sugar for prepending the source
31+
* directory of the calling file to the module name, forming a system of
32+
* relative name lookup.
33+
*
34+
* Relative name lookup cannot ascend levels in the filesystem, nor can it be
35+
* used to exit the virtual filesystem. It's merely a shorthand to implicitly
36+
* specify the module name of the calling file as a prefix to the module name
37+
* passed to `require()`. This is done as follows:
38+
*
39+
* -- when called from myname/modname/mod-load.lua
40+
* require '.module-A'
41+
* -- this call is transformed into:
42+
* require 'myname.modname.module-A'
43+
*
44+
* Once the full module name has been established, it is run through several
45+
* levels of lookup. First, the module name is tested against the import
46+
* cache, then against the list of modules registered by C++ code. Finally,
47+
* it is converted into a file path and tested against the filesystem to
48+
* load a lua file from disk.
49+
*
50+
* Filesystem lookup follows the usual rules; a file in a mod overrides files
51+
* earlier in the mod load order, and the overriden files cannot be loaded
52+
* from disk. If there is a C++ module with a specific name, it overrides all
53+
* Lua files with that name.
54+
*
55+
* The `package.core` object stores C++ modules for convenience. Access
56+
* is by standard Lua notation - `package.core.PiGui.Modules.ModelSpinner`
57+
* works just fine, as does `require 'PiGui.Modules.ModelSpinner'`.
58+
*
59+
* The `package.reimport(name)` function purges the cache for a specific
60+
* module name and repeats the loading process - useful for when a file
61+
* changes on disk as part of development.
62+
*/
6363

6464
// The cache table that stores file path -> module return value mappings
6565
static const char *IMPORT_CACHE_NAME = "Imports";
@@ -76,8 +76,8 @@ struct ImportInfo {
7676
};
7777

7878
/**
79-
* Returns path of last element in the lua stack
80-
*/
79+
* Returns path of last element in the lua stack
80+
*/
8181
static std::string get_caller(lua_State *L, int depth = 1)
8282
{
8383
// XXX: Extraneous copy
@@ -114,13 +114,13 @@ static std::string get_caller(lua_State *L, int depth = 1)
114114
}
115115

116116
/**
117-
* Generate a lua module name from a given input path.
118-
* If the path contains a directory component containing a separator (period)
119-
* this function will return an empty string, as lua module names cannot contain
120-
* a non-separating period.
121-
* This function discards the trailing component of the directory path. If you
122-
* wish to retain it, ensure the path string ends with '/'.
123-
*/
117+
* Generate a lua module name from a given input path.
118+
* If the path contains a directory component containing a separator (period)
119+
* this function will return an empty string, as lua module names cannot contain
120+
* a non-separating period.
121+
* This function discards the trailing component of the directory path. If you
122+
* wish to retain it, ensure the path string ends with '/'.
123+
*/
124124
static std::string path_to_module(std::string path)
125125
{
126126
std::string module_name;

0 commit comments

Comments
 (0)
X Tutup