diff --git a/CHANGELOG.md b/CHANGELOG.md index 6142a01..68fb6b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -108,4 +108,12 @@ All notable changes to the "dcs-lua-runner" extension will be documented in this ## [1.2.1] - 2024-05-30 ### Changed -- Lower the minimum required version of VS Code to 1.70.0. \ No newline at end of file +- Lower the minimum required version of VS Code to 1.70.0. + +## [1.2.2] - 2024-06-06 + +### Added +- Handling of string number keys + +### Fixed +- Handling of decimal number keys diff --git a/package.json b/package.json index c4eb50b..87dad85 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Quickly run lua code in DCS World (local or remote server). A reimplementation of the DCS Fiddle lua console in VS Code.", "license": "MIT", "publisher": "omltcat", - "version": "1.2.1", + "version": "1.2.2", "icon": "docs/img/icon.png", "repository": { "type": "git", diff --git a/src/extension.ts b/src/extension.ts index 05cfb82..532449c 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -65,7 +65,8 @@ async function runLua(lua: string, outputChannel: vscode.OutputChannel, filename // Replace JSON syntax with Lua syntax luaString = luaString.replace(/null/g, 'nil'); // Replace null with nil luaString = luaString.replace(/"((?:[^"\\]|\\.)+)":/g, '["$1"] ='); // Replace "key": with ["key"] = - luaString = luaString.replace(/\["_([0-9]+)"\]\s*=/g, '[$1] ='); // Replace ["_n"] = with [n] = + luaString = luaString.replace(/\["_([0-9.]+)"\]\s*=/g, '[$1] ='); // Replace ["_n"] or ["_n.m"] = with [n] or [n.m] = + luaString = luaString.replace(/\["([0-9.]+)"\]\s*=/g, '[$1] ='); // Replace ["n"] or ["n.m"] = with [n] or [n.m] = luaString = luaString.replace(/\[\]/g, '{}'); // Replace [] with {} luaString = luaString.replace(/\[\n/g, '{\n'); // Replace [ followed by a line break with { followed by a line break luaString = luaString.replace(/]\n/g, '}\n'); // Replace ] followed by a line break with } followed by a line break