hank Posted April 6, 2012 Share Posted April 6, 2012 How to pass parameters? I have this code below: passar = function(aa,bb) local cc = aa local dd = bb return cc,dd end recebe = function() --I want to receive the value cc, dd function "pass". Here. How? end Link to comment
Castillo Posted April 6, 2012 Share Posted April 6, 2012 I'm not sure if I understood you, do you mean this? passar = function ( aa, bb ) local cc = aa local dd = bb return cc, dd end recebe = function ( ) --I want to receive the value cc, dd function "pass". Here. How? local cc, dd = passar ( ) print ( cc ..": ".. dd ) end Link to comment
hank Posted April 6, 2012 Author Share Posted April 6, 2012 Your code worked. Something else. pegarVar = function(aa,bb) local cc = aa local dd = bb return cc, dd end addEvent("enviarVar",true) addEventHandler("enviarVar",getRootElement(),pegarVar) recebeVar = function() end Code client receives variables from the code server. Now I want to pass the variables to other functions. (recebeVar receives variables cc,dd) How? Link to comment
Castillo Posted April 6, 2012 Share Posted April 6, 2012 local cc, dd pegarVar = function(aa,bb) cc = aa dd = bb end addEvent("enviarVar",true) addEventHandler("enviarVar",getRootElement(),pegarVar) recebeVar = function ( ) end Now your variables will be global, so you can use them outside "pegarVar" function. 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