botanist Posted March 18, 2011 Posted March 18, 2011 Hi thar, after some inactivity I picked my Handling Editor project back up and started with optimalization of the code. But, now I need to get a table that's made clientside into the server using triggerServerEvent. What I'm currently doing does not work: -- Client log = {} -- Not local! log.succes = "Test String" triggerServerEvent ( "onEvent", blah, log ) -- Where "blah" are some irrelevant arguments -- Server addEvent ( "onEvent", true ) addEventHandler ( "onEvent", root, function ( blah, log ) string.format ( log.succes, blah ) -- Produces the "Not Indexed" error end ) Is there any way to do this correct?
DakiLLa Posted March 18, 2011 Posted March 18, 2011 Look at the 2nd parameter of the triggerServerEvent function: it is a variable representing the source of the function you call. So: -- Client log = {} -- Not local! log.succes = "Test String" triggerServerEvent ( "onEvent", getLocalPlayer(), blah, log ) -- Server addEvent ( "onEvent", true ) addEventHandler ( "onEvent", root, function ( blah, log ) string.format ( log.succes, blah ) end )
Discord Moderators Zango Posted March 18, 2011 Discord Moderators Posted March 18, 2011 triggerServerEvent second parameter is element source. This argument isn't passed as function argument but in source form. Therefore your blah argument is log, and log argument is nil (if that makes sense ). edit: fuck snap I'm being overhauled D:
botanist Posted March 18, 2011 Author Posted March 18, 2011 triggerServerEvent ( "onEvent", getLocalPlayer(), blah, log ) Which is included with the "blah" arguments, forgot to mention that So, that can't be the reason. Wait, I think I got the problem. Give me a moment. Yep, stupid me. I always forget to check variablenames for any mistakes. So, solved. Lol.
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