Jump to content

How to give arguments to function on handler?


Recommended Posts

Is possible to pass arguments to the function that is called from the handler??

I mean..

I have this handler:

  
function() 
  
local x,y = 10,50 
addEventHandler("onClientRender", getRootElement(), doSomething) 
  
end 
  
function doSomething() 
  -- HOW can I have access here to that arguments above? the x and the y ? thanks alot in advance... 
end 
  
  

EDIT: I tryed this but doesnt work !

  
addEventHandler("onClientRender", getRootElement(), showInfoAboutTimes(x,y)) 
  

Gives me this error :

[2012-07-07 20:43:28] WARNING: bp\client_testbar.lua:11: Bad argument @ 'addEventHandler' [Expected function at argument 3, got none]

Thanks again

Link to comment

make it global, without local

  
function() 
  
x,y = 10,50 
addEventHandler("onClientRender", getRootElement(), doSomething) 
  
end 
  
function doSomething() 
  -- HOW can I have access here to that arguments above? the x and the y ? thanks alot in advance... 
end 
  
  

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...