Thomasims / TeardownUMF

Teardown Unofficial Modding Framework
The Unlicense
37 stars 14 forks source link

Fixed missing arguments to string.format call #28

Closed noob247365 closed 1 year ago

noob247365 commented 1 year ago

The same %s.%s._type style is used later in this same helper method for storing values at line 333, presumably they should match

Summary of testing issue

If you try using string.format without supplying the appropriate parameters, it throws an error, so I'm uncertain how this was not an issue before.

Code tested:

print( string.format( "%s.%s._type" ) )

Result:

input:1: bad argument #2 to 'format' (no value)

Summary of fix

Fix to code proposed: Add in name and key to fill the %s spots, just as it is done on line 333

Code tested:

local name = "name"
local key = "key"
print( string.format( "%s.%s._type", name, key ) )

Result:

name.key._type
noob247365 commented 1 year ago

I realized why this was never an issue before. It's only utilized if trying to use the table properties of gets/sets. I think most people are probably using the registry helpers for nesting options, not storing tables directly. There should really be a unit test mod for this 😛

Thomasims commented 1 year ago

Good catch thanks for the PR. I barely ever use util.shared_table myself but I'm still surprised I never ran into this since it's used around the place in different tools. Most people who use this framework I would imagine only really use the pre-built packages which definitely don't contain this version of the file.