Jump to content

Very Important Question "Pointers" to Table


Recommended Posts

Posted

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!

Posted

"tableOnClient" is a pointer to the table.

No, it does not get removed on server.

Yes, it's like a clone.

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

Posted

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

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

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

Posted (edited)

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

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

Posted

Maybe you can create a element server side, set to that element the table, and when the element data changes client side, you update the table with it's new value?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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