Hi Przemek.
First, thanks for your job.
Second: Do you have intentions to share hashToXml() and xmlToHash() please
?
Regards,
Toninho.
I see in my mail box that few people asked about it.
I'm attaching the code.
begin sequence with {||break()}
? d[ "A", 2, "B" ]
recover
? "*"
end sequence
function my_HGet( hVal, xDefault, ... )
local xResult
begin sequence with {||break()}
xResult := hVal[ ... ]
recover
xResult := xDefault
end sequence
return xResult
> BTW this function might also have a pair to set an
> arbitrary element in a complex JSON/XML like var:
> HB_HSET( <hHash|aArray>, <xIndex|aIndex>, <xValue> )
function my_HSet( hVal, xValue, ... )
local xResult
begin sequence with {||break()}
hVal[ ... ] := xValue
xResult := .t.
recover
xResult := .f.
end sequence
return xResult
As you can see such code can be quite easy created by user.
If you want to use array as indexes then it's enough to
replace ... with aIndex and then use hb_arrayToParams( aIndex ).
Anyhow we can extend HB_HGET*()/HB_G_SET() functions to accept
arrays as set of indexes or create separate functions for it
just like above ones which will operate on arrays.