Skip to content

Commit

Permalink
transform$
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangnanscu committed Sep 26, 2024
1 parent cfdf802 commit 5c6646c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xiangnanscu/js2lua",
"version": "0.35.0",
"version": "0.36.0",
"type": "module",
"description": "Writing LuaJIT with the expressiveness of JavaScript.",
"main": "src/js2lua.mjs",
Expand Down Expand Up @@ -55,4 +55,4 @@
"vite-plugin-require-transform": "^1.0.21",
"vue-eslint-parser": "^9.3.1"
}
}
}
3 changes: 3 additions & 0 deletions src/js2lua.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const defaultOptions = {
debug: false,
tagArrayExpression: true,
importStatementHoisting: true,
transform$SymbolToDollar: true,
transformToString: true,
transformString: true,
transformJSONStringify: true,
Expand Down Expand Up @@ -475,6 +476,8 @@ function ast2lua(ast, opts = {}) {
const id = ast.name;
if (id == "undefined") {
return "nil";
} else if (id.startsWith("$")) {
return opts.transform$SymbolToDollar ? id.replace("$", "_DOLLAR_") : id;
}
return id;
}
Expand Down

0 comments on commit 5c6646c

Please sign in to comment.