M
M
Mark Eshkilev2021-06-01 07:06:38
Lua
Mark Eshkilev, 2021-06-01 07:06:38

How to use k from previous for?

Hello, please help me, I don’t understand at all how to do this
, there is a code

for k in pairs(metadmin.plombs) do
  local sub3, row = sub2:AddSubMenu(k)
  row:SetTextInset(10,0)
  for k,v in pairs(metadmin.plombs.tt) do
    sub3:AddOption(v, function()
      net.Start("metadmin.order")
        net.WriteEntity(line.ply)
        net.WriteBool(true)
        net.WriteString(k)
      net.SendToServer()
      tabs:Remove()
    end):SetTextInset(10,0)
  end
end

How can I make it so that instead of metadmin.plombs.tt there is metadmin.plombs.k where k is the data from the previous for, I hope you understand what I mean, please help

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Shvedov, 2021-06-01
@mark_edinoroglove

Well, when declaring the second for, you overwrite k, change the name to another so that it does not intersect with k from the outer loop

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question