Getting Started
Releases publish to Basalt's public Maven repository, so no authentication is needed to depend on Luak. Pick the path that matches your project.
JVM projects
Two artifacts are available for the JVM. luak-jvm is the common case: it
pulls in the multiplatform core plus JvmPlatform.standardGlobals(),
luajava, io.popen and os.execute, the
luajc JIT compiler, CLI tooling, and javax.script
integration. luak-core-jvm is the shared runtime alone, for when you
don't need the JVM-only integrations or want the smallest footprint.
// build.gradle.kts
repositories {
maven("https://repo.basaltmc.org/releases")
}
dependencies {
implementation("org.basaltmc:luak-jvm:26.5")
}
luak-jvm pulls in luak-core-jvm transitively, so depending on it alone is enough for most projects.
Other Kotlin Multiplatform targets
luak-core is only distributed as a Kotlin Multiplatform library: every
non-JVM target is a Kotlin .klib, consumable from another Kotlin
Multiplatform Gradle project. It is not a raw JS or npm package, and not a
C-callable native library.
// build.gradle.kts
repositories {
maven("https://repo.basaltmc.org/releases")
}
kotlin {
js { nodejs() }
wasmJs { nodejs() }
wasmWasi { nodejs() }
linuxX64()
macosArm64()
sourceSets {
commonMain {
dependencies {
implementation("org.basaltmc:luak-core:26.5")
}
}
}
}
Your first script
LuaPlatform.standardGlobals() works on every target, so no target needs
a hand-assembled Globals.
import org.basaltmc.luak.lib.LuaPlatform
val globals = LuaPlatform.standardGlobals()
globals.load("print('hello, world')")!!.call()
LuaPlatform.debugGlobals() adds the debug library. Loading
individual classes from org.basaltmc.luak.lib (BaseLib,
PackageLib, TableLib, StringLib,
CoroutineLib, MathLib, Utf8Lib,
IoLib, OsLib) by hand remains available when you want a
smaller footprint. Bit32Lib is also there, unused by
standardGlobals(), for an embedder that specifically wants the bitwise
library from older Lua versions back. See the
Standard Library guide for
what each one provides.