In the new ULib, we'll have a cool little feature I've termed self propagating tables. It will let you share information between server and clients without lots of nasty concommands or SendLua's. Basically, you put whatever information you want to share in an appropriate table, and it will automatically send it to the server or clients for you!
Our initial version will only be for sharing from server to clients, but we'll expand upon that in future versions. Here's actual output from console:
] lua_run ULib.global.server.bob = "hi there buddy"
> ULib.global.server.bob = "hi there buddy"...
] lua_run_cl "print( ULib.global.server.bob )"
> print( ULib.global.server.bob )...
hi there buddy
] lua_run ULib.global.server.t = { joe=false, pos=Vector( 10, 780.1, 0 ) }
> ULib.global.server.t = { joe=false, pos=Vector( 10, 780.1, 0 ) }...
] lua_run_cl "print( ULib.global.server.t )"
> print( ULib.global.server.t )...
table: 0276C1C0
] lua_run_cl "print( ULib.global.server.t.joe )"
> print( ULib.global.server.t.joe )...
false
] lua_run_cl "print( ULib.global.server.t.pos )"
> print( ULib.global.server.t.pos )...
10.0000 780.1000 0.0000
The information from the table set on the server is instantly available to clients.
Client-side, this table is read-only...
] lua_run_cl "ULib.global.server.noes = 'testing'"
> ULib.global.server.noes = 'testing'...
[LC ULIB ERROR] Attempt to modify read-only table!
] lua_run_cl "print( ULib.global.server.noes )"
> print( ULib.global.server.noes )...
nil
Downsides:
* Obviously, you don't want to store a million strings here as it would have consequences on memory and network performance.
* Strings are limited to ~200 characters due to the way we have to send it.
* Only supports Angles, Vectors, Colors (since they're tables), strings, booleans, tables, and numbers