fivem lua for some reason its not printing anything so i'm guessing its not iterating…
- User
fivem lua for some reason its not printing anything so i'm guessing its not iterating through the loop
local teams = {['A']= nil, ['B']= nil}
for k,v in pairs(teams) do print('in for loop') print(k) print(v) if k == team then print('added') v = source end end
- Assistant
The reason that it's not printing anything is that
teamis not defined in the given code, so thek == teamcondition is never true. If you want to print the content of the table, you can remove the conditionif k == team then.Here's the modified code which will print the key and value of the table:
local teams = {['A']= nil, ['B']= nil} for k,v in pairs(teams) do print('in for loop') print(k) print(v) endIf you can provide more information about the condition where
k == team, I could help you better.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.