Interacting with Java and Kotlin
How To Interact With Java and Kotlin classes in Lua ?
someClass = requireJVM("dev.gabagool.important.SomeClass")-- we get the value of the variable in a class
local theFunny = someClass.theFunnyVariable
-- we invoke a method or a function and retrive the result
local funnyMachineResult = someClass:funnyMachine()local updateThread = Thread(function()
-- only run the job on the thread if the lua module is enabled
while isEnabled() do
counter = counter + 1
Thread:sleep(1000)
end
end)
updateThread:start()onDisable(function()
counter = 0
-- if we check in the thread like above, we should close the thread like this
-- but if the thread has no checks you can close it in the onDisable hook
updateThread:interrupt()
end)Last updated