• Need help with Net.WriteTable
    1 replies, posted
Why i can't recive table on client side? Server [LUA] util.AddNetworkString( "RequestTable" ) util.AddNetworkString( "SendTable" ) local _file = "items/" .. ply:UniqueID( ) .. ".txt" local _read = util.JSONToTable( file.Read( _file, "DATA" ) ) net.Receive( "RequestTable", function( ln, ply ) net.Start( "SendTable" ) net.WriteTable( _read ) net.Send( ply ) end) [/LUA] Client [LUA] _table = {} net.Receive( "SendTable", function() _table = net.ReadTable() end) [/LUA]
Because RequestTable is never called? Also, you don't need two different network strings for that. Server [LUA] util.AddNetworkString( "RequestTable" ) local _file = "items/" .. ply:UniqueID( ) .. ".txt" local _read = util.JSONToTable( file.Read( _file, "DATA" ) ) net.Receive( "RequestTable", function( ln, ply ) net.Start( "RequestTable" ) net.WriteTable( _read ) net.Send( ply ) end) [/LUA] Client [LUA] local _table = {} net.Start("RequestTable") net.SendToServer() net.Receive( "RequestTable", function() _table = net.ReadTable() end) [/LUA]
Sorry, you need to Log In to post a reply to this thread.