LUA Script Docs

Documentation -> Late Night Miner LUA Integration

Please download with-lua version of Late Miner, the file name must include “with-lua”. (late-night-miner-with-lua-x.x.x.exe)

From version 0.1.1 we added integrated LUA Script engine, now you can communicate with the miner using simple LUA API.

We are in early beta stage with this feature, the API is still limited but we working to expand it.

The miner will search for script.lua file, need to be located relative to the miner in same folder.

Miner to LUA

The miner is function in your LUA script (callbacks).
Just implement these functions.

LateNight_preInit – Before miner init.
LateNight_postInit – After miner init.
LateNight_preExec – Before main execution.
LateNight_postExec – After main execution.
LateNight_onJobReceived – New job received from the pool.
LateNight_onLoginSuccess – Pool login success.
LateNight_onResultAccepted – Results accepted in pool.

Example:

Save as scipt.lua file

function LateNight_preInit ()
	print("LateNight_preInit")
end
 
function LateNight_postInit ()
	print("LateNight_postInit")
end
 
function LateNight_preExec ()
	print("LateNight_preExec")
end
 
function LateNight_postExec ()
	print("LateNight_postExec")
end
 
function LateNight_onJobReceived ()
	print("LateNight_onJobReceived")
end
 
function LateNight_onLoginSuccess ()
	print("LateNight_onLoginSuccess")
 
end
 
function LateNight_onResultAccepted ()
	print("LateNight_onResultAccepted")
end

Miner to LUA API

The API from LUA to the miner is separated to modules, currently only 2 modules are supported but we will add more modules in each new release.
Remember, its only early beta – please report us any bug and missing feature you need, we will try to prioritize the tasks by users needs.

Works module API

LateNightWorkers.printHashrate() – Print current hashrate summary.
LateNightWorkers.isPaused() – Is the miner paused.
LateNightWorkers.isEnabled() – Is the miner enabled.
LateNightWorkers.setEnabled(true | false) – Set miner state (enabled/disabled)
LateNightWorkers.getHashrateShort() – Get hashrate for last 10 sec.
LateNightWorkers.getHashrateMedium() – Get hashrate for last 1 min.
LateNightWorkers.getHashrateLarge() – Get hashrate for last 190 min.
LateNightWorkers.getHashrateTop() – Get max hashrate.

CPU module API

LateNightCpu.hasAES() – Is AES suppoted by CPU.
LateNightCpu.is64bit() – Is 64Bit CPU.
LateNightCpu.getBrand() – CPU Brannd.
LateNightCpu.getCores() – Number of CPU Cores.
LateNightCpu.l2() – L2 size.
LateNightCpu.l3() – L3 size.
LateNightCpu.getSockets() – Number of sockets.
LateNightCpu.getThreads() – Number of threads.

Full example:

function LateNight_preInit ()
	print("LateNight_preInit")
end
 
function LateNight_postInit ()
	print("LateNight_postInit")
end
 
function LateNight_preExec ()
	print("LateNight_preExec")
end
 
function LateNight_postExec ()
	print("LateNight_postExec")
	LateNightWorkers.printHashrate()
 
	print("LateNightWorkers.isPaused: "  .. tostring(LateNightWorkers.isPaused()))
 
	print("LateNightWorkers.isEnabled: "  .. tostring(LateNightWorkers.isEnabled()))
	LateNightWorkers.setEnabled(false)
	print("LateNightWorkers.isEnabled: "  .. tostring(LateNightWorkers.isEnabled()))
	LateNightWorkers.setEnabled(true)
	print("LateNightWorkers.isEnabled: "  .. tostring(LateNightWorkers.isEnabled()))
 
	print("LateNightWorkers.getHashrateShort: "  .. tostring(LateNightWorkers.getHashrateShort()))
	print("LateNightWorkers.getHashrateMedium: "  .. tostring(LateNightWorkers.getHashrateMedium()))
	print("LateNightWorkers.getHashrateLarge: "  .. tostring(LateNightWorkers.getHashrateLarge()))
	print("LateNightWorkers.getHashrateTop: "  .. tostring(LateNightWorkers.getHashrateTop()))
 
	print("LateNightCpu.hasAES: "  .. tostring(LateNightCpu.hasAES()))
	print("LateNightCpu.is64bit: "  .. tostring(LateNightCpu.is64bit()))
	print("LateNightCpu.getBrand: "  .. tostring(LateNightCpu.getBrand()))
	print("LateNightCpu.getCores: "  .. tostring(LateNightCpu.getCores()))
	print("LateNightCpu.l2: "  .. tostring(LateNightCpu.l2()))
	print("LateNightCpu.l3: "  .. tostring(LateNightCpu.l3()))
	print("LateNightCpu.getSockets: "  .. tostring(LateNightCpu.getSockets()))
	print("LateNightCpu.getThreads: "  .. tostring(LateNightCpu.getThreads()))
end
 
function LateNight_onJobReceived ()
	print("LateNight_onJobReceived")
end
 
function LateNight_onLoginSuccess ()
	print("LateNight_onLoginSuccess")
 
end
 
function LateNight_onResultAccepted ()
	print("LateNight_onResultAccepted")
end