Skip to content

benglard/luaimport

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

luaimport - Easy imports/packages for Lua

luaimport presents (what I think is) an interesting method for handling the creation of packages/modules in Lua.

To use luaimport, follow these steps:

  • require 'luaimport'
  • Create a table (local or global both work) to store your package, e.g. lib = {}
  • Call Package with a single string or table argument corresponding to those file(s) that will be imported into the package
  • (optional) return the package, e.g. return lib

Example Usage

-- testfile.lua
return {
   test = true,
   word = 'hi'
}
-- testlib.lua
require 'luaimport'
local testlib = Package 'testlib'
return testlib
-- init.lua
require 'luaimport'
lib = Package {
    'libfile1',
    'libfile2',
    'libfile3'
}

About

Easy imports/packages for Lua

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages