@gwigz/slua-tstl-plugin 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +10 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -308,6 +308,16 @@ const CALL_TRANSFORMS = [
308
308
  return createNamespacedCall("string", "sub", args, node);
309
309
  },
310
310
  },
311
+ // str.replaceAll(search, replacement) -> ll.ReplaceSubString(str, search, replacement, 0)
312
+ {
313
+ match: (node, checker) => isMethodCall(node, checker, isStringType, "replaceAll", 2),
314
+ emit: (node, context) => {
315
+ const str = context.transformExpression(node.expression.expression);
316
+ const search = context.transformExpression(node.arguments[0]);
317
+ const replacement = context.transformExpression(node.arguments[1]);
318
+ return createNamespacedCall("ll", "ReplaceSubString", [str, search, replacement, tstl.createNumericLiteral(0)], node);
319
+ },
320
+ },
311
321
  // arr.includes(val) -> table.find(arr, val) ~= nil
312
322
  {
313
323
  match: (node, checker) => isMethodCall(node, checker, isArrayType, "includes", 1),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gwigz/slua-tstl-plugin",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "TypeScriptToLua plugin for targeting Second Life's SLua runtime",
5
5
  "license": "MIT",
6
6
  "repository": {