<commit_before>Test = { pPluginManager = nil }


function Test:Init(kernel, self)
	io.write("Hello Lua Init!\n");
end

function Test:AfterInit(kernel, self)
	io.write("Hello Lua AfterInit!\n");

	if kernel == nil then
		io.write("kernel is nil\n");
	end

	if self == nil then
		io.write("self is nil\n");
	end

	io.write("Start use C++ functions\n");
	nMaxhp = GetPropertyInt(kernel, self, "MAXHP");
	--io.write("Hello Lua MAXHP:" ..nMaxhp .. "\n");

	--property callback
	AddPropertyCallBack(kernel, self, "MAXHP", "Test", "MaxPropertyCallBack");
	local maxHP = 400;
	SetPropertyInt(kernel, self, "MAXHP", maxHP);

	nMaxhp = GetPropertyInt(kernel, self, "MAXHP");
	--io.write("Hello Lua GetPropertyInt MAXHP:" ..nMaxhp .. "\n");

	--record callback
	AddRecordCallBack(kernel, self, "TaskList","Test", "TaskListCallBack");

	local varTask =  NFCDataList();
	varTask:AddString("Task_From_Lua");
	varTask:AddInt(1);
	varTask:AddInt(1);

	AddRow(kernel, self, "TaskList", varTask);
	SetRecordInt(kernel, self, "TaskList", 0, 1, 3);
	SetRecordString(kernel, self, "TaskList", 0, 0, "NewStr_Task_From_Lua");
	--event callback
	AddEventCallBack(kernel, self, 1, "Test", "EventCallBack");

	local obj = NFCDataList();
	obj:AddInt(21);
	obj:AddFloat(22.5);
	obj:AddString("str23");

	local ident = NFGUID();
	ident:SetHead(241);
	ident:SetData(242);

	obj:AddObject(ident);

	io.write("aaaaaaaaaaaaaaaaaa\n");
	DoEvent(kernel, self, 1, obj);

	--Hearback
	AddHeartBeat(kernel, self, "strHeartBeatName","Test", "HearCallBack", 1, 55);
end

function Test:BeforeShut(kernel, self)
	io.write("Hello Lua BeforeShut\n");
end

function Test:Shut(kernel, self)
	io.write("Hello Lua Shut\n");
end


function Test:MaxPropertyCallBack(kernel, self, propertyName, oldVar, newVar, arg)
	local nOldVar = oldVar:GetInt();
	local nNewVar = newVar:GetInt();

	local obj = NFCDataList();
	--io.write("Hello Lua MaxPropertyCallBack oldVar:".. nOldVar .." newVar:" .. nNewVar .. "\n");
	io.write("Hello Lua MaxPropertyCallBack oldVar:" .. tostring(nOldVar) .. " newVar:" .. tostring(nNewVar) .. "\n");
end

function Test:TaskListCallBack(kernel, self, recordName, nOpType, nRow, nCol, oldVar, newVar, arg)
	if nCol == 0 then<commit_msg>modified function of lua table<commit_after>Test = { pPluginManager = nil }


function Test:Init()
	io.write("Lua Init!\n");
	io.write(tostring(pPluginManager));
end

function Test:AfterInit()
	io.write("Lua AfterInit!\n");
	
end

function Test:BeforeShut()
	io.write("Lua BeforeShut!\n");
end

function Test:Shut()
	io.write("Lua Shut!\n");
end
--[[
function Test:AfterInit(kernel, self)
	io.write("Hello Lua AfterInit!\n");

	if kernel == nil then
		io.write("kernel is nil\n");
	end

	if self == nil then
		io.write("self is nil\n");
	end

	io.write("Start use C++ functions\n");
	nMaxhp = GetPropertyInt(kernel, self, "MAXHP");
	--io.write("Hello Lua MAXHP:" ..nMaxhp .. "\n");

	--property callback
	AddPropertyCallBack(kernel, self, "MAXHP", "Test", "MaxPropertyCallBack");
	local maxHP = 400;
	SetPropertyInt(kernel, self, "MAXHP", maxHP);

	nMaxhp = GetPropertyInt(kernel, self, "MAXHP");
	--io.write("Hello Lua GetPropertyInt MAXHP:" ..nMaxhp .. "\n");

	--record callback
	AddRecordCallBack(kernel, self, "TaskList","Test", "TaskListCallBack");

	local varTask =  NFCDataList();
	varTask:AddString("Task_From_Lua");
	varTask:AddInt(1);
	varTask:AddInt(1);

	AddRow(kernel, self, "TaskList", varTask);
	SetRecordInt(kernel, self, "TaskList", 0, 1, 3);
	SetRecordString(kernel, self, "TaskList", 0, 0, "NewStr_Task_From_Lua");
	--event callback
	AddEventCallBack(kernel, self, 1, "Test", "EventCallBack");

	local obj = NFCDataList();
	obj:AddInt(21);
	obj:AddFloat(22.5);
	obj:AddString("str23");

	local ident = NFGUID();
	ident:SetHead(241);
	ident:SetData(242);

	obj:AddObject(ident);

	io.write("aaaaaaaaaaaaaaaaaa\n");
	DoEvent(kernel, self, 1, obj);

	--Hearback
	AddHeartBeat(kernel, self, "strHeartBeatName","Test", "HearCallBack", 1, 55);
end
--]]

function Test:MaxPropertyCallBack(kernel, self, propertyName, oldVar, newVar, arg)
	local nOldVar = oldVar:GetInt();
	local nNewVar = newVar:GetInt();

	local obj = NFCDataList();
	--io.write("Hello Lua MaxPropertyCallBack oldVar:".. nOldVar .." newVar:" .. nNewVar .. "\n");
	io.write("Hello Lua MaxPropertyCallBack oldVar:" .. tostring(nOldVar) .. " newVar:" .. tostring(nNewVar) .. "\n");
end

function Test:TaskListCallBack(kernel, self, recordName, nOpType, nRow, nCol, oldVar, newVar, arg)
	if nCol == 0 then
{'fraction_non_alphanumeric': 0.1732739420935412, 'fraction_numerical': 0.012917594654788419, 'mean_word_length': 5.246175243393602, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '518972', 'n_tokens_mistral': 1728, 'n_tokens_neox': 1628, 'n_words': 383}