tilgep / stripper

Sourcepawn implementation of Stripper:Source
20 stars 8 forks source link

Original configs are not supported without modifications #2

Closed oleg35hp closed 1 year ago

oleg35hp commented 1 year ago

[stripper.smx] Section declared without header on line 109, col 1 of addons/sourcemod/configs/stripper/global_filters.cfg

taken from https://www.bailopan.net/stripper/

filter: { "prop1" "val1" } { "prop3" "val3" }

tilgep commented 1 year ago

This is an error from the SMCParser, there is no easy way for me to fix this as sections are required to have a header when parsing a file using one.

I would argue that its not great that the original stripper allows this as it can be ambiguous what the block is doing if you aren't aware that it defaults to filter and carries the previous mode over to the next block if undefined, which can make the config harder to read. I understand its not ideal that its not fully backwards compatible, but for 99% of configs this shouldn't be a problem and it can be easily fixed.

I'm not going to fix this in the plugin, you can make the blocks without headers filter: to have the same functionality.
For other configs, you must set the header to the last defined header, or filter if there is no defined header above.

Using your example, the fixed version would be:

filter:
{
"prop1" "val1"
}
filter:
{
"prop3" "val3"
}