Jump to content

Very Important Question "Pointers" to Table


Recommended Posts

Hi there guys, I guess the origin of my problem on another topic is because I am not using the same table, its not a clone .. I guess.

SO here it is :

1) I have table A on SERVER side .

2) I send my table A to client side

3) I have a function on client side that receives the table, and I assign my local variable to the table A that is received, like:

  
  
local tableOnClient = {} 
  
function funcThatReceivesTable(tablereceived) 
tableOnClient = tablereceived 
end 
  
  

MY QUESTION: Is this a pointer to the table? and when I remove a element from this table on client, it gets removed also on the table on the server? or when I send a table to server side, its a clone ?

Thanks in advance!

Link to comment
"tableOnClient" is a pointer to the table.

No, it does not get removed on server.

Yes, it's like a clone.

Hmm I though it would not be a clone :S

So.. I need to remove on both tables, when I want to keep the same info , right ?

Thanks in advance ..

Link to comment
Yes, but why would you do need same table on both sides?

Because this is a table of objects, and I must destroy and create new ones, on server side, to work for all clients .

And I also need that table of objects on client side, because there is a function (only client side) that will tell me, if I wanna destroy a object of that table . if yes, i delete from the table on client and then I trigger server event, and destroy that element and delete from table on server side.

Do you understand ? is something bad doing this ? if so, please explain me how to do it good ,

thanks alot in advance.

Link to comment

You can do it all in server-side and trigger client event to call that function that "asks" if wanna destroy object from tableand triggering the answer to the server to delete / not delete the object.

Do you understand?

Edited by Guest
Link to comment

Guys nevermind, I already get it working, using another paradigm. I mean I leaved the two tables (server and client side) solution, and implemented setElementData, and I dont need any tables being sent via triggers :)

Thanks alot all of you that helped ;)

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