Moderators IIYAMA Posted March 28, 2013 Moderators Share Posted March 28, 2013 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
DiSaMe Posted March 28, 2013 Share Posted March 28, 2013 That's because you're creating the table before creating the functions. Link to comment
Moderators IIYAMA Posted March 28, 2013 Author Moderators Share Posted March 28, 2013 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now