From c4842cb9aa81634799dce0a5cfa76654b9f17ab4 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sat, 11 Apr 2015 10:06:08 +0200 Subject: Added more cFile API functions. GetLastModificationTime, GetPathSeparator() and GetExecutableExt() --- MCServer/Plugins/Debuggers/Debuggers.lua | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'MCServer/Plugins/Debuggers/Debuggers.lua') diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index c8e96d378..d255c0f8f 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -9,7 +9,7 @@ g_ShowFoodStats = false; -- When true, each player's food stats are sent to the -function Initialize(Plugin) +function Initialize(a_Plugin) --[[ -- Test multiple hook handlers: cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnTick1); @@ -45,14 +45,12 @@ function Initialize(Plugin) -- Bind all the console commands: RegisterPluginInfoConsoleCommands(); - Plugin:AddWebTab("Debuggers", HandleRequest_Debuggers) - Plugin:AddWebTab("StressTest", HandleRequest_StressTest) + a_Plugin:AddWebTab("Debuggers", HandleRequest_Debuggers) + a_Plugin:AddWebTab("StressTest", HandleRequest_StressTest) -- Enable the following line for BlockArea / Generator interface testing: -- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATED); - LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion()) - -- TestBlockAreas() -- TestSQLiteBindings() -- TestExpatBindings() @@ -63,6 +61,10 @@ function Initialize(Plugin) -- TestUUIDFromName() -- TestRankMgr() TestFileExt() + TestFileLastMod() + + local LastSelfMod = cFile:GetLastModificationTime(a_Plugin:GetLocalFolder() .. "/Debuggers.lua") + LOG("Debuggers.lua last modified on " .. os.date("%Y-%m-%dT%H:%M:%S", LastSelfMod)) --[[ -- Test cCompositeChat usage in console-logging: @@ -92,6 +94,19 @@ end +function TestFileLastMod() + local f = assert(io.open("test.txt", "w")) + f:write("test") + f:close() + local filetime = cFile:GetLastModificationTime("test.txt") + local ostime = os.time() + LOG("file time: " .. filetime .. ", OS time: " .. ostime .. ", difference: " .. ostime - filetime) +end + + + + + function TestPluginCalls() -- In order to test the inter-plugin communication, we're going to call Core's ReturnColorFromChar() function -- It is a rather simple function that doesn't need any tables as its params and returns a value, too -- cgit v1.2.3