Module merger
Lua modules merger.
Functions
| merge_modules (modules, debug, write) | Combines multiple Lua modules into single chunk using package.preload. |
Local Functions
| write_wrapped_chunk (write, chunk) | Wraps the given chunk in a function. |
| write_wrapped_chunk_debug (write, chunk, name) | Wraps the given chunk using loadstring. |
Functions
- merge_modules (modules, debug, write)
-
Combines multiple Lua modules into single chunk using package.preload.
Parameters:
- modules {[string]=string,...} Map of modules name to chunks (source code).
- debug bool Preserve module names and line numbers?
- write optional function The writer function. If not give, an intermediate table will be created and the resulting chunk returned as string.
Returns:
-
optional string
A Lua chunk of combined modules, or nil if the
writefunction given.
Local Functions
- write_wrapped_chunk (write, chunk)
-
Wraps the given
chunkin a function. This method does not preserve file name and line numbers.Parameters:
- write
- chunk
- write_wrapped_chunk_debug (write, chunk, name)
-
Wraps the given
chunkusing loadstring. This method produces bigger output, but it preserve file name and line numbers for error messages and trackbacks, so it's better for debugging.Parameters:
- write
- chunk
- name