Skip to content

A rule for injecting libraries #213

Open
@jiwonz

Description

inject_modules rule would be great for injecting libraries and global functions too (exampe: injecting libraries of luau written in pure lua to emulate luau outside of luau)

Example

.darklua.json5

rules: {
  inject_libraries: {
    libraries: [
      {
        name: "buffer",
        path: "buffer.lua"
      },
      {
        name: "typeof",
        path: "typeof.lua"
      }
    ]
  }
}

src/main.lua

print(typeof(buffer.create))

After processing:

local buffer = require("{top_path}/_DARKLUA_lib{buffer_blake3_hash}")
local typeof = require("{top_path}/_DARKLUA_lib{typeof_blake3_hash}")
print(typeof(buffer.create))

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions