Team Spartan Cookies & Milk Forums
  • Issue Tracker
  • Donations
  • Search
  • Member List
  • Help

Register

Team Spartan Cookies & Milk Forums Garry's Mod Starfall v
1 2 3 4 5 … 18 Next »
Spooky action at a distance, remote callbacks (server only, client doesnt work?)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linear Mode
Spooky action at a distance, remote callbacks (server only, client doesnt work?)
22-09-2025, 03:28 AM,
#2
The17thDoctor Online
TSCM Average Enjoyer
****
Posts: 1,100
Threads: 249
Joined: Oct 2015
RE: Spooky action at a distance, remote callbacks (server only, client doesnt work?)
It seems normal that the second approach with net won't work.

When you store a function as a variable, you're storing a reference to that function, not the function itself.

When the net library sends a table to your client, the most probable behaviour that happens is that when it sees that function reference, it just discards it.
Why ? Because that function only makes sense in the context of the server. Even if you were to send the reference to the client, it would be pointing to a random part of your computer's memory (which is very probably not gmod's memory).

To better illustrate, let's take this simple code here :
--@shared

function a()
print("Hello world!")
end

local realm = "???"
if SERVER then realm = "SERVER" end
if CLIENT then realm = "CLIENT" end

print(realm .. " : " .. tostring(a)

When I run this starfall, I get this result :
SERVER : function: 0xec9efc7a
CLIENT : function: 0x8088096aeae87c2a

As you can see, the function is stored at wildly different places on server vs. on client, and that's the same function !

This doesn't happen with channels because although the starfall instances seem separate, it's all ran by GLua under the hood, so the reference does resolve and is able to be executed.

Aside from that it's interesting to see what could be done with that trick.

The17thDoctor: Server take me to the most handsome person
srcds_linux: I cant send people to themselves...
Website Find
Reply
« Next Oldest | Next Newest »


Messages In This Thread
Spooky action at a distance, remote callbacks (server only, client doesnt work?) - by Caprica - 21-09-2025, 06:10 PM
RE: Spooky action at a distance, remote callbacks (server only, client doesnt work?) - by The17thDoctor - 22-09-2025, 03:28 AM
RE: Spooky action at a distance, remote callbacks (server only, client doesnt work?) - by Caprica - 22-09-2025, 03:14 PM

  • View a Printable Version
Forum Jump:


Users browsing this thread: 1 Guest(s)
Contact UsTeam Spartan Cookies & MilkReturn to TopLite (Archive) ModeMark all forums readRSS Syndication

Powered By MyBB, © 2002-2026 MyBB Group.