01-13-2015, 02:46 PM
In an attempt to test if this theory is indeed possible, I wrote the following short plugin to do one thing: Create a JavaVM and print "Hello, world!" to the screen.
Note: lua5.1.dll has been replaced with jnlua5.1.dll and renamed to access the jnlua functions.
This plugin gives the following error:
Warn [22:40:00] cPluginManager:AddHook(): bad parameters. Expected
HOOK_TYPE and CallbackFunction, got number, nil, no value. Hook not added.
Warn [22:40:00] Stack trace:
Warn [22:40:00] [C](-1): AddHook
Warn [22:40:00] Plugins/JavaVM/main.lua(8): (no name)
Warn [22:40:00] Stack trace end
[22:40:00] Initialised JavaVM v.1
Since I am lost as to why the AddHook call is not recognizing the CallbackFunction, can someone please point it out to me?
Note: lua5.1.dll has been replaced with jnlua5.1.dll and renamed to access the jnlua functions.
function Initialize(Plugin)
Plugin:SetName("JavaVM")
Plugin:SetVersion(1)
-- Hooks
cPluginManager.AddHook(cPluginManager.HOOK_WORLD_STARTED, initiatejavavm)
function initiatejavavm(javavm)
javavm = require("javavm")
javavm.create("-Djava.class.path=jnlua-0.9.6.jar")
System = java.require("java.lang.System")
System.out:println("Hello, world!")
javavm.destroy()
end
PLUGIN = Plugin -- NOTE: only needed if you want OnDisable() to use GetName() or something like that
-- Command Bindings
LOG("Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
return true
end
function OnDisable()
LOG(PLUGIN:GetName() .. " is shutting down...")
end
This plugin gives the following error:
Warn [22:40:00] cPluginManager:AddHook(): bad parameters. Expected
HOOK_TYPE and CallbackFunction, got number, nil, no value. Hook not added.
Warn [22:40:00] Stack trace:
Warn [22:40:00] [C](-1): AddHook
Warn [22:40:00] Plugins/JavaVM/main.lua(8): (no name)
Warn [22:40:00] Stack trace end
[22:40:00] Initialised JavaVM v.1
Since I am lost as to why the AddHook call is not recognizing the CallbackFunction, can someone please point it out to me?

