From 4e34e438f12abb31f2409ce9d50df8acc2128555 Mon Sep 17 00:00:00 2001 From: faketruth Date: Thu, 26 Jan 2012 20:39:46 +0000 Subject: Working on a new plugin design with Lua. While retaining backwards compatibility of course... In this new design a plugin consists of a folder with Lua files, this should enable plugin developers to keep things separate and have more overview. git-svn-id: http://mc-server.googlecode.com/svn/trunk@172 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- Plugins/NewTest/main.lua | 17 +++++++++++++++++ Plugins/NewTest/tick.lua | 5 +++++ 2 files changed, 22 insertions(+) create mode 100644 Plugins/NewTest/main.lua create mode 100644 Plugins/NewTest/tick.lua (limited to 'Plugins') diff --git a/Plugins/NewTest/main.lua b/Plugins/NewTest/main.lua new file mode 100644 index 000000000..cd8df03e5 --- /dev/null +++ b/Plugins/NewTest/main.lua @@ -0,0 +1,17 @@ +LOGINFO("main.lua!!") +LOOLOL = "12345" +PLUGIN = {} + +function Initialize( Plugin ) + LOGINFO("Initialize in main.lua") + PLUGIN = Plugin + + Plugin:SetName("LOLOL new plugin!") + + PluginManager = cRoot:Get():GetPluginManager() + PluginManager:AddHook( Plugin, cPluginManager.E_PLUGIN_TICK ) + + LOGINFO("Plugin name is: " .. Plugin:GetName() ) + + return true +end \ No newline at end of file diff --git a/Plugins/NewTest/tick.lua b/Plugins/NewTest/tick.lua new file mode 100644 index 000000000..69de13c65 --- /dev/null +++ b/Plugins/NewTest/tick.lua @@ -0,0 +1,5 @@ +LOGINFO("tick.lua!! ") + +function Tick( DeltaTime ) + LOGINFO("Tick in tick.lua; LOOLOL = " .. LOOLOL .. " Plugin name = " .. PLUGIN:GetName() ) +end \ No newline at end of file -- cgit v1.2.3