generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: found a pathetic ass bug

Previous Thread :: Next Thread 
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
18 Jan 2015 03:58 PM
if you have a remote function and invoke it from the client and it returns a table with a metatable, the metatable doesn't persist.

this is ruining my game

--remote function
script.Parent.OnServerInvoke = function(sender)
return setmetatable({}, {})
end

--local script
local x = workspace.RemoteFunction:InvokeServer()
print(getmetatable(x)) --> nil

THIS IS RUINING MY GAME I HAVE TO REDESIGN MY WHOLE CLASS SYSTEM NOW WTF ROBLOX
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
18 Jan 2015 04:00 PM
eww ass bugs
Report Abuse
BuildIntoGames is not online. BuildIntoGames
Joined: 02 Sep 2011
Total Posts: 6634
18 Jan 2015 04:00 PM
https://www.youtube.com/watch?v=tl2OzaVATXg
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
18 Jan 2015 04:02 PM
HOW TF DO I FIX THIS OMFG KYS ROBLOX

Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
18 Jan 2015 04:02 PM
I don't think you can return a table from the server to the client since it doesn't exist in the client's memory.

Although maybe Roblox copies it to memory? To test this, print(x) and see if you get nil or not.
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
18 Jan 2015 04:03 PM
print(getmetatable(x)) --> nil
print(x) --> table: 0xe37b7e0
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
18 Jan 2015 04:05 PM
Well in any case, you might as well just return 2 tables and use setmetatable client-side.
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
18 Jan 2015 04:05 PM
im mad

my whole game is based on a class system that stores methods in the metatable
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
18 Jan 2015 04:06 PM
okay thanks cnt

i did that and it works

it's uglier, but oh well
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
18 Jan 2015 04:38 PM
omg i figured it out

remote functions return a copy of the table, not a reference

:((

--remote function
script.Parent.OnServerInvoke = function(sender, array)
return array
end

--local script
x = {}
print(x == workspace.RemoteFunction:InvokeServer(x)) --> false
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
18 Jan 2015 04:40 PM
Well yeah, but I would assume a copy of the table would also include the MT D:
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
18 Jan 2015 04:41 PM
A reference would practically impossible since the table only really existed on the server /cry
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
18 Jan 2015 04:43 PM
well here's the thing

i need to return the table from the server and be able to manipulate it from the server AND client

so when i change a number from the client, its not the same as changing it from the server

all the constants are the same, but anything that varies causes bugs D:
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
18 Jan 2015 04:45 PM
That's not possible, you would have to return the "altered" table and same with the metatable if you change that.

Think about it, on the server let's say our table started at 1F23456 yet on the client, that might be something completely different. So the server would have to copy the full table since a reference to 1F23456 on the client would point to something possible completely different.
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
18 Jan 2015 04:46 PM
ok thanks

here's the next question:

i plan on storing values in the server storage now

i want the model containing the values to be named with the current time (tick())

is it possible for the same time to return twice?
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
18 Jan 2015 04:49 PM
Well, it depends.

For example:
local x, y = tick(), tick();
x would (in theory) be equal to y.

However:
print(tick());
print(tick());
Would be different since there is some delay while printing to the output.
Report Abuse
Koufasa is not online. Koufasa
Joined: 07 Jun 2008
Total Posts: 482
02 Apr 2015 12:46 AM
Same issue here with metatables. Any way around this?
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
02 Apr 2015 12:53 AM
Why do you need to send the table to begin with? Can't you just make modifications server-side then push them to the client?
Report Abuse
Koufasa is not online. Koufasa
Joined: 07 Jun 2008
Total Posts: 482
02 Apr 2015 12:58 AM
Here's my issue:

The client wants to get the properties of an object. The properties are stored in a metatable server-side. The client sends a request to the server asking for the properties. The server returns the metatable, however when the client tries to access the properties, we end up with an error because we can't find them.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
02 Apr 2015 02:28 AM
"but I would assume a copy of the table would also include the MT D:"
Thanks a million, now I need to go through every script I have ever written in my gigabyte Roblox folder and see if any of them copy tables, just so I can modify it to copy metatables too.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
02 Apr 2015 02:31 AM
You're welcome :(
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
02 Apr 2015 02:33 AM
Joking. Until a few months ago, I didn't even know that tables were only referenced.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image