Chaos Posted April 28, 2016 Share Posted April 28, 2016 hi, i got problem with this code, i'm trying to get ID from event name but it seems not working and every time it gives random number and the event names is containing space any idea? addEvent('nextEventVoteResult') addEventHandler('nextEventVoteResult', getRootElement(), function(eventName) local eventID = getIDFromEventName(eventName) outputChatBox(eventID,root) end ) function getIDFromEventName(eventName) for i,v in ipairs(events) do if v.name == eventName then return i end end return false end Link to comment
pro-mos Posted April 29, 2016 Share Posted April 29, 2016 I dont think you can do this, you need to define the function first, then use it like function getIDFromEventName() ... ...... then addEvent ...... Link to comment
Anubhav Posted April 29, 2016 Share Posted April 29, 2016 I dont think you can do this, you need to define the function first, then use itlike function getIDFromEventName() ... ...... then addEvent ...... Wrong. It is not like that. The server side script loads and then whenever that event is triggered, that function is already loaded so the function is triggered. Also, may I see your events table? I guess that is the problem or do you sort the table using table.sort? Link to comment
pro-mos Posted April 29, 2016 Share Posted April 29, 2016 Wrong. It is not like that. The server side script loads and then whenever that event is triggered, that function is already loaded so the function is triggered. Also, may I see your events table? I guess that is the problem or do you sort the table using table.sort? Thanks for the correction Link to comment
Anubhav Posted April 29, 2016 Share Posted April 29, 2016 Wrong. It is not like that. The server side script loads and then whenever that event is triggered, that function is already loaded so the function is triggered. Also, may I see your events table? I guess that is the problem or do you sort the table using table.sort? Thanks for the correction Welcome 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