Closed
Description
I'd like to use this in the browser, however, trying it out with
- "@prettier/plugin-lua": "0.0.1",
- "prettier": "^2.2.1"
const prettier = require("prettier");
const plugin = require("@prettier/plugin-lua");
function format_lua(s) {
return prettier.format(s, { parser: "lua" });
}
format_lua("function deepcopy(orig)
local orig_type = type(orig)
local copy
if orig_type == 'table' then; copy = {}
for orig_key, orig_value in next, orig, nil do
copy[deepcopy(orig_key)] = deepcopy(orig_value)
end
setmetatable(
copy,
deepcopy(
getmetatable(orig)))
else
copy = orig
end
return copy
end")
gives:
format_lua("function deepcopy(orig)
^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Invalid or unexpected token
at wrapSafe (node:internal/modules/cjs/loader:1024:16)
at Module._compile (node:internal/modules/cjs/loader:1072:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
at node:internal/main/run_main_module:17:47
Metadata
Metadata
Assignees
Labels
No labels