Porting Java-based mods to Lua
#3
Further edit of the code:

function Initialize(Plugin)
	Plugin:SetName("JavaVM")
	Plugin:SetVersion(1)
	
	-- Hooks
	cPluginManager.AddHook(cPluginManager.HOOK_WORLD_STARTED, initiatejavavm())
  
  function initiatejavavm()
    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()
    return true
    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

Produces this error:

Warn [22:58:08] LUA: Plugins/JavaVM/main.lua:8: attempt to call global 'initiatejavavm' (a nil value)
Warn [22:58:08] Stack trace:
Warn [22:58:08] Plugins/JavaVM/main.lua(8): (no name)
Warn [22:58:08] Stack trace end
Warn [22:58:08] Error in plugin JavaVM calling function Initialize()
Warn [22:58:08] Error in plugin JavaVM: Cannot call the Initialize() function. Plugin is temporarily disabled.

Any ideas?
Reply
Thanks given by:


Messages In This Thread
Porting Java-based mods to Lua - by Atro - 01-13-2015, 01:22 PM
RE: Porting Java-based mods to Lua - by Atro - 01-13-2015, 02:46 PM
RE: Porting Java-based mods to Lua - by Atro - 01-13-2015, 02:59 PM
RE: Porting Java-based mods to Lua - by Howaner - 01-13-2015, 04:14 PM
RE: Porting Java-based mods to Lua - by xoft - 01-13-2015, 05:05 PM
RE: Porting Java-based mods to Lua - by Atro - 01-13-2015, 05:13 PM
RE: Porting Java-based mods to Lua - by xoft - 01-13-2015, 06:14 PM
RE: Porting Java-based mods to Lua - by Defkil - 02-20-2015, 03:03 AM
RE: Porting Java-based mods to Lua - by LO1ZB - 02-20-2015, 03:10 AM
RE: Porting Java-based mods to Lua - by worktycho - 02-20-2015, 03:57 AM



Users browsing this thread: 1 Guest(s)