Moderators IIYAMA Posted March 28, 2013 Moderators 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
DiSaMe Posted March 28, 2013 Posted March 28, 2013 That's because you're creating the table before creating the functions.
Moderators IIYAMA Posted March 28, 2013 Author Moderators 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
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