Skip to content

Commit 62806b6

Browse files
authored
Add support for PushedTexture (fixes #5) - and fix syntax errors on frame names with illegal characters
1 parent 69c52ea commit 62806b6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/XmlFileParser.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ class XmlFileParser
1717
private const array TYPE_ALIASSES = [
1818
'FontFamily' => 'Font',
1919
'NormalTexture' => 'Texture',
20-
'HighlightTexture' => 'Texture',
20+
'HighlightTexture' => 'Texture',
2121
'ThumbTexture' => 'Texture',
22+
'PushedTexture' => 'Texture',
2223
'ColorWheelTexture' => 'Texture',
2324
'ColorWheelThumbTexture' => 'Texture',
2425
'ColorValueTexture' => 'Texture',
@@ -36,6 +37,7 @@ class XmlFileParser
3637
'NormalTexture',
3738
'HighlightTexture',
3839
'ThumbTexture',
40+
'PushedTexture',
3941
'ColorWheelTexture',
4042
'ColorWheelThumbTexture',
4143
'ColorValueTexture',
@@ -191,8 +193,8 @@ private function childHasInterestingData(Frame $child): bool
191193

192194
private function wrapInGIfNeeded(string $name): string
193195
{
194-
if (str_contains($name, '$')) {
195-
return '_G["' . $name . '"]';
196+
if (!preg_match('/^[A-z][A-z0-9]*$/', $name)) {
197+
return '_G["' . str_replace('"', '\\"', $name) . '"]';
196198
}
197199

198200
return $name;

0 commit comments

Comments
 (0)