View Single Post
08/16/15, 02:47 PM   #22
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
@Randactyl that's not how it works.

strings["de"] is still the same table. The metatable's __index provides fallback values for missing keys. But it's only scanned when you explicitly request a missing key, e.g.
strings["de"]["SI_MYADDON_GENERAL_OPTIONS_HEADER"]. Iterating over it with next/pairs will only see SI_MYADDON_NAME, because that's the only key in the table itself.

To make it work, you need to iterate over the "en" table:
Lua Code:
  1. for k in next, strings["en"] do
  2.     ZO_CreateStringId(k, strings[lang][k])
  3. end

On a positive note, you don't have to clean the local strings table -- it should be garbage-collected afterwards.

Last edited by merlight : 08/16/15 at 02:50 PM.
  Reply With Quote