View Single Post
  #1  
Unread 12-31-2021, 12:57 PM
goldbishop goldbishop is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Nov 2010
Posts: 30
PluginData Load problem

So I have this little code that doesnt seem to populate, ever:
Code:
data = Turbine.PluginData.Load( Turbine.DataScope.Account, "LocationLog_Data" );
I initially had this in a Class file, where it will be closest to need.

As I did some searching and information gathering, I bubbled up to the Main file to no avail; at which point, I even bubbled it up the INI file and same result.

Activities I have tried
  • I have used a Callback method
  • I have used it locally (part of the Window Class) and globally (part of Main and INI)

even with a 30 secs wait, I have not seen a change in the TreeView I am trying to populate.

Below is the code that leverages the "theoretical" loaded data.
Code:
function LocationLogWindow:InitializeData()
	LoadDataIntoTreeView(data);
	
	Turbine.Shell.WriteLine("@data Count: " .. #data );
end 

function LoadDataIntoTreeView(dat)
	Turbine.Shell.WriteLine("Data File Count: " .. #dat );
	
	if ( dat ~= nil ) then
		-- data = dat;
		
		Turbine.Shell.WriteLine("LoadDataIntoTreeView @data Count: " .. #dat );
		rootNode = tvData:GetNodes();
		
		-- @k1 - Table Key; @v1 Table Value
		for k1, v1 in pairs (dat) do
			-- Turbine.Shell.WriteLine( "Node: " .. k1 );
			local node = tvNode();
			rootNode:Add( node );
			
			local subNodes = node:GetChildNodes();
			
			for k2, v2 in pairs (v1) do
				-- Turbine.Shell.WriteLine( "Region: " .. k2 );
				local node = tvNode();
				subNodes:Add( node );
				
				local subNodes = node:GetChildNodes();
				
				for k3, v3 in pairs (v2) do
					-- Turbine.Shell.WriteLine( "Coord: " .. k3 );
					local node = tvNode();
					subNodes:Add( node );					
				end 
			end 
		end 
	else 
		Turbine.Shell.WriteLine("@data not available");
	end 
end
Shell WriteLine result on Loading of the Plugin:
Code:
Data File Count: 0
LoadDataIntoTreeView @data Count: 0
@data Count: 0
Reply With Quote