| 1.45 NetPropertyBag . |
| 1.45.1 NetPropertyBag.Create . |
| 1.45.2 NetPropertyBag.DeleteFromNet . |
| 1.45.3 NetPropertyBag.GetBaglndex . |
| 1.45.4 NetPropertyBag.GetEventBag . |
| 1.45.5 NetPropertyBag.GetField . |
| 1.45.6 NetPropertyBag.GetOwnerld . |
| 1.45.7 NetPropertyBag.GetTypeld . |
| 1.45.8 NetPropertyBag.GetTypeldForBag . |
| 1.45.9 NetPropertyBag.IsOwnedLocally. |
| 1.45.10 NetPropertyBag.IsReplicated . |
| 1.45.11 NetPropertyBag.ReplicateToNet . |
| 1.45.12 NetPropertyBag.SetField . |
|
|
| NetPropertyBag |
| NetPropertyBag. Create |
| Brief |
| Creates a new NetPropertyBag. |
| Definition |
| ! NetPropertyBag NetPropertyBag.Create( string bagDefinitionName ) |
| Arguments |
| bagDefinitionName - The name of the bag definition XML file resource. |
| Return Values |
| A new instance of a network property bag. |
| Description |
| Creates a new NetPropertyBag from an XML definition resource file. |
| Examples |
| ! bag = NetPropertyBag.Create( "player" ) |
| See Also |
| � NetPropertyBag.GetEventBag |
| NetPropertyBag. DeleteFromNet |
| Brief |
| Deletes a locally owned and replicated bag from the network. |
| Definition |
| ! NetPropertyBag.DeleteFromNet( NetPropertyBag bag ) |
| Arguments |
| bag - The instance of the property bag. |
| Return Values |
| None. |
| Description |
| Deletes a locally owned and replicated bag from the network. The bag isn't deleted from memory at this point and so can be replicated again at a |
| later time. |
| Examples |
| ! if NetPropertyBag.IsReplicated( bag ) and NetPropertyBag.IsOwnedLocally( bag ) then |
| NetPropertyBag.DeleteFromNet( bag ) |
| j end |
| See Also |
| NetPropertyBag. IsReplicated |
| NetPropertyBag.ReplicateToNet |
| NetPropertyBag.GetBaglndex |
| Brief |
| Returns the index of a property bag. |
| Definition |
| ! number NetPropertyBag.GetBaglndex( NetPropertyBag bag ) |
| Arguments |
| bag - The instance of the property bag. |
| Return Values |
| The bag index. |
| Description |
| Returns the index of a property bag. |
| Please be aware that this index is only unique to the client that instantiated the bag, so each bag created on a client will have a unique value, |
| however, it is not a globally unique value across clients. |
| Examples |
| j local baglndex = NetPropertyBag.GetBaglndex( bag ) |
| See Also |
| None |
| NetPropertyBag.GetEventBag |
| Brief |
| Returns an instance of the bag that is the focus of the current event. |
| Definition |
| ! NetPropertyBag NetPropertyBag.GetEventBag() |
| Arguments |
| None |
| Return Values |
| The NetPropertyBag that is the focus of the current event. |
| Description |
| Returns an instance of the bag that is the focus of the current event. Only valid during a bag created/deleted event, as named by the |
| 'on_bag_created' and 'on_bag_deleted' properties of the 'network' object component in the HDK's Object Editor application. |
| Examples |
| gNetBags = { }; |
| function OnBagCreated( ) |
| local bag = NetPropertyBag.GetEventBag( ); |
| local bagld = bag:GetTypeld( ); |
| �We keep a reference to a stats and skills bag which only one person creates |
| if bagld == NetPropertyBag.GetTypeldForBag( "statistics" ) then |
| gNetBags[ "gamestats" ] = bag; |
| elseif bagld == NetPropertyBag.GetTypeldForBag( "skills" ) then |
| gNetBags[ "skills" ] = bag; |
| end |
| end |
| See Also |
| � NetPropertyBag.Create |
| NetPropertyBag.GetField |
| Brief |
| Gets a value from a field in the property bag. |
| Definition |
| variant NetPropertyBag.GetField( NetPropertyBag bag, string fieldName, table dest = nil ) |
| Arguments |
| bag - The instance of the property bag.fieldName - The name of the field to request.dest - An optional table parameter, if provided we fill this table |
| instead of creating one from scratch |
| Return Values |
| The boolean/number/string/table value contained in the field. |
| Description |
| Gets a value from a field in the property bag. Any client to which the bag has been replicated can call this function. Note that array fields are |
| supported, in this case a table will be returned containing all the values in the array. |
| Examples |
| local name = NetPropertyBag.GetField( bag, "name" ) |
| print (s) |
| local array = NetPropertyBag.GetField( bag, "array" ) |
| for i, v in ipairs(array) do |
| print(tostring(v)) |
| end |
| local mytable = {} |
| local array = NetPropertyBag( bag, "array", mytable ) |
| See Also |
| � NetPropertyBag.SetField |
| NetPropertyBag.GetOwnerld |
| Brief |
| Returns the person id of the owner of the bag. |
| Definition |
| ! string NetPropertyBag.GetOwnerld( NetPropertyBag bag ) |
| Arguments |
| bag - The instance of the property bag. |
| Return Values |
| The person id of the game owner. |
| Description |
| Returns the person id of the owner of the bag. |
| Examples |
| ! local bagOwnerld = NetPropertyBag.GetOwnerld( bag ) |
| ! bagOwner = Person.Findlnlnstance( bagOwnerld ) |
| See Also |
| � Person.Findlnlnstance |
| NetPropertyBag.GetTypeld |
| Brief |
| Returns the type id of the bag. |
| Definition |
| ! number NetPropertyBag.GetTypeld( NetPropertyBag bag ) |
| Arguments |
| bag - The instance of the property bag. |
| Return Values |
| The bag's type id. |
| Description |
| Returns the type id of the bag. |
| Examples |
| bag = NetPropertyBag.Create( "Player" ); |
| if bag:GetTypeld( ) == NetPropertyBag.GetTypeldForBag( "Player" ) then |
| print( "Both bags are of the same type" ); |
| else |
| print( "Bags have different types" ); |
| end |
| See Also |
| � NetPropertyBag.GetTypeldForBag |
| NetPropertyBag.GetTypeldForBag |
| Brief |
| Returns the type id for the specified property bag. |
| Definition |
| number NetPropertyBag.GetTypeldForBag( string bagDefinitionName ) |
| Arguments |
| bagDefinitionName - The definition name. |
| Return Values |
| The bag's type id. |
| Description |
| Returns the type id for the specified property bag. |
| Examples |
| bag = NetPropertyBag.Create( "Player" ); |
| if bag:GetTypeld( ) == NetPropertyBag.GetTypeldForBag( "Player" ) then |
| print( "Both bags are of the same type" ); |
| else |
| print( "Bags have different types" ); |
| end |
| See Also |
| � NetPropertyBag.GetTypeld |
| NetPropertyBag. IsOwnedLocally |
| Brief |
| Returns the local ownership state of a bag. |
| Definition |
| boolean NetPropertyBag.IsOwnedLocally( NetPropertyBag bag ) |
| Arguments |
| bag - The instance of the property bag. |
| Return Values |
| True if the bag is owned locally. |
| Description |
| Returns the local ownership state of a bag. |
| Examples |
| ! local isOwnedByMe = NetPropertyBag.IsOwnedLocally( bag ) |
| See Also |
| None |
| NetPropertyBag. IsReplicated |
| Brief |
| Returns the replicated state of a bag. |
| Definition |
| ! boolean NetPropertyBag.IsReplicated( NetPropertyBag bag ) |
| Arguments |
| bag - The instance of the property bag. |
| Return Values |
| True if the bag has been replicated to the network. |
| Description |
| Returns the replicated state of a bag. |
| Examples |
| ! local isReplicated = NetPropertyBag.IsReplicated( bag ) |
| See Also |
| � NetPropertyBag.DeleteFromNet |
| � NetPropertyBag. ReplicateToNet |
| NetPropertyBag. ReplicateToNet |
| Brief |
| Replicates a locally owned bag to the network. |
| Definition |
| ! NetPropertyBag.ReplicateToNet( NetPropertyBag bag ) |
| Arguments |
| bag - The instance of the property bag. |
| Return Values |
| None. |
| Description |
| Replicates a locally owned bag to the network. |
| Examples |
| ! NetPropertyBag.ReplicateToNet( bag ) |
| See Also |
| � NetPropertyBag.DeleteFromNet |
| � NetPropertyBag.IsReplicated |
| NetPropertyBag.SetField |
| Brief |
| Sets a field in the property bag. |
| Definition |
| NetPropertyBag.SetField( NetPropertyBag bag, string fieldName, variant value ) |
| Arguments |
| bag - The instance of the property bag.fieldName - The name of the field to set.value - boolean/number/string/table to store in the field. |
| Return Values |
| None. |
| Description |
| Sets a field in the property bag. The bag must be owned locally for this function to succeed. Note that array fields are supported, in this case a |
| table should be supplied of an equal or lesser number of items as the array field size. In the case of the table having less elements than the field |
| size, the remaining elements in the field are not updated. |
| Examples |
| NetPropertyBag.SetField( bag, "booleanValue", true ) |
| NetPropertyBag.SetField( bag, "numberValue", 3.14159 ) |
| NetPropertyBag.SetField( bag, "stringValue", "Hello World" ) |
| NetPropertyBag.SetField( bag, "arrayValue", { 1, 2, 3, 4 } ) |
| See Also |
| NetPropertyBag.GetField |