Jump to content

Return table from Serverside ?


evox91

Recommended Posts

Hello,

How can i return a table from server to client ?

  
--server 
function f() 
return table 
end 
  
addEvent( "f", true ) 
addEventHandler( "f", getRootElement(), f) 
  
--client 
  
table =triggerServerEvent("f",getRootElement()) ? 
  

Link to comment
  • Other Languages Moderators

Client

  
addEvent( 'Send', true ) 
  
addEventHandler( 'Send', root, 
    function( Table ) 
        outputChatBox( Table.n ) -- 1 
    end 
) 
  

Server

triggerClientEvent( root, 'Send', root, { n = 1 } ) 

or you can use set/get elementData.

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...