LoTROInterface

LoTROInterface (https://www.lotrointerface.com/forums/index.php)
-   Lua Programming Help (L) (https://www.lotrointerface.com/forums/forumdisplay.php?f=50)
-   -   PluginData Load problem (https://www.lotrointerface.com/forums/showthread.php?t=3877)

goldbishop 12-31-2021 12:57 PM

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


goldbishop 12-31-2021 01:03 PM

Ok....typical me....2 mins after posting it, I solve my own problem on rendering.

I am curious why the LUA count mechanism isn't working.
Code:

#table

Hyoss 01-01-2022 06:36 AM

Quote:

Originally Posted by goldbishop (Post 12749)
Ok....typical me....2 mins after posting it, I solve my own problem on rendering.

I am curious why the LUA count mechanism isn't working.
Code:

#table

The Lua # operator only counts entries with integer keys: http://www.lua.org/manual/5.1/manual.html#2.5.5


All times are GMT -5. The time now is 01:15 PM.

vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI