[gmod-industrialization] addons/gmod-industrialization/lua/modules/ui_elements.lua:4: attempt to call field 'AddNetworkString' (a nil value)
  1. unknown - addons/gmod-industrialization/lua/modules/ui_elements.lua:4
   2. include - [C]:-1
    3. unknown - addons/gmod-industrialization/lua/autorun/industrialization_init.lua:47
```lua
-- lua/modules/ui_elements.lua

if CLIENT then
    util.AddNetworkString("Industrialization_UpdateInventory")
    util.AddNetworkString("Industrialization_UpdateFactory")
    util.AddNetworkString("Industrialization_UpdateSmelter")
    util.AddNetworkString("Industrialization_UpdateAssemblyMachine")
    util.AddNetworkString("Industrialization_UpdateHarvester")
    util.AddNetworkString("Industrialization_UpdatePowerStatus")

    -- Table to store player inventory
    local PlayerInventoryUI = {}

    -- Receive inventory updates from the server
    net.Receive("Industrialization_UpdateInventory", function()
        local inventory = net.ReadTable()
        PlayerInventoryUI = inventory -- Utilize the 'inventory' variable
        -- Refresh the inventory UI if it's open
        if IsValid(vgui.GetControl("DFrame", "Industrialization_InventoryFrame")) then
            local frame = vgui.GetControl("DFrame", "Industrialization_InventoryFrame")
            local list = frame:GetChildren()[1] -- Assuming the DListView is the first child
            list:Clear()
            for resource, qty in pairs(PlayerInventoryUI) do
                if qty > 0 then
                    list:AddLine(ResourceTypes[resource].name or resource, qty)
                end
            end
        end
    end)

    -- Function to create and display the inventory UI
    function CreateInventoryUI()
        if IsValid(vgui.GetControl("DFrame", "Industrialization_InventoryFrame")) then return end

        local frame = vgui.Create("DFrame")
        frame:SetTitle("Inventory")
        frame:SetSize(400, 600)
        frame:Center()
        frame:MakePopup()
        frame:SetName("Industrialization_InventoryFrame")

        local list = vgui.Create("DListView", frame)
        list:Dock(FILL)
        list:AddColumn("Resource")
        list:AddColumn("Quantity")

        for resource, qty in pairs(PlayerInventoryUI) do
            if qty > 0 then
                list:AddLine(ResourceTypes[resource].name or resource, qty)
            end
        end
    end

    -- Bind a key to open the inventory (e.g., F1)
    hook.Add("PlayerButtonDown", "Industrialization_OpenInventory", function(ply, button)
        if ply ~= LocalPlayer() then return end
        if button == KEY_F1 then
            CreateInventoryUI()
        end
    end)

    -- Factory Control Panel (example)
    function CreateFactoryControlPanel(factory)
        if not IsValid(factory) then return end
        if IsValid(vgui.GetControl("DFrame", "Industrialization_ControlPanelFrame")) then return end

        local frame = vgui.Create("DFrame")
        frame:SetTitle("Factory Control Panel")
        frame:SetSize(300, 200)
        frame:Center()
        frame:MakePopup()
        frame:SetName("Industrialization_ControlPanelFrame")

        local startButton = vgui.Create("DButton", frame)
        startButton:SetText("Start Processing")
        startButton:SetPos(50, 50)
        startButton:SetSize(200, 30)
        startButton.DoClick = function()
            factory:StartProcessing()
            frame:Close()
        end

        local stopButton = vgui.Create("DButton", frame)
        stopButton:SetText("Stop Processing")
        stopButton:SetPos(50, 100)
        stopButton:SetSize(200, 30)
        stopButton.DoClick = function()
            factory:StopProcessing()
            frame:Close()
        end
    end

    -- Similar functions can be created for Smelter, Assembly Machine, etc.
end
```