• Announcement: Lua.org now officially recommends this forum as a meeting place for the Lua community
  • The forum is currently open to new registrations. The registration will close for a short period of time when reaching 500 active members, to upgrade the server resources.

Attempt to call global 'winners' (a table value) (1 Viewer)

fuad

Newcomer
Joined
Aug 9, 2020
Messages
4
Reaction score
2
Age
31
Location
israel
hi all

i hope if some one can help me, i am new with lua and i try to understand what going on with my simple code

this is my code

Lua:
function win(classMates , winners)
    res = {}
    for i=1,#winners do
        for j=1,#classMates do
            print(3)
            if winners == classMates[j] then res = 1 else res = 0 end
            print(res)
        end
    end
end

classMates = {"frank" , "alex" , "soli"}
winners = {"lora" , "frank" , "sandra" ,"alex"}

print(winners(classMates,winners))

if i run it i have a debbug -- >

Code:
lua: [string "<eval>"]:15: attempt to call global 'winners' (a table value)
stack traceback:
     [string "<eval>"]:15: in main chunk

any help ? any one know why ?
 
Top