Jump to content

Tables with function triggers


IIYAMA

Recommended Posts

  • Moderators

Is it possible to store triggers in tables?

Because this isn't working.

  
local functionTable = {hey,hoi,hi} 
addCommandHandler("hey", 
function (player,cm) 
    lol = functionTable[1] 
        lol() 
end) 
  
function hey() 
    outputChatBox("hey") 
end 
  
function hoi() 
    outputChatBox("hoi") 
end 
  
function hi() 
    outputChatBox("hi") 
end 

Link to comment
  • Moderators

ah thank you!!!

local functionTable = {} 
addCommandHandler("hey", 
function (player,cm) 
    lol = functionTable[1] 
    lol() 
end) 
  
functionTable[1]=function() 
    outputChatBox("hey") 
end 
  
functionTable[2]=function() 
    outputChatBox("hoi") 
end 
  
functionTable[3]= function() 
    outputChatBox("hi") 
end 
  

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...