CommandHelper

CommandHelper

46.5k Downloads

get_values() not respecting namespaces matches

LadyCailinBot opened this issue ยท 1 comments

commented

CMDHELPER-2666 - Reported by Praxter.oy

'''What steps will reproduce the problem?'''

  1. Create the following command in config.txt
/testfoo = >>>
  store_value('foo.x', 1)
  store_value('foo3.x', 1)
  foreach(get_values('foo'), @key, @value) {
    msg(@key)
  }
  clear_value('foo.x')
  clear_value('foo3.x')
<<<
  1. Reload the aliases using /reloadalias
  2. Run the command /testfoo

'''What is the expected output? What do you see instead?'''

I expect the output to be foo.x
but instead I see:

foo.x
foo3.x

'''What version of the product are you using?'''

I am using Command Helper 1475-a3e96a3

'''Do you have an error log of what happened?'''

No errors in the logs. Only wrong results.

'''Please provide any additional information below.'''

According to the documentation:
Only full namespace matches are considered, so if the key 'users.data.username.hi' existed in the database, and you tried get_values('users.data.user'), nothing would be returned.

That is why I expected only one element returned by "get_values()".

I also tried:

/testfoo2 = >>>
  store_value('foo.foo.x', 1)
  store_value('foo.foobar.x', 1)
  foreach(get_values('foo.foo'), @key, @value) {
    msg(@key)
  }
  clear_value('foo.foo.x')
  clear_value('foo.foobar.x')
<<<

which also prints the two keys and not only one. I thought maybe the fact that I used a number was the cause but I get the wrong result with this code as well. (I get two keys printed instead of one).

Did I misunderstand something?

commented

Comment by LadyCailin

Will be fixed in the next build!