mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 07:04:52 +09:00
Fix missing documentation for parameters and return types, incorect config and errors in type definitions.
27 lines
456 B
JavaScript
27 lines
456 B
JavaScript
/**
|
|
* Utilities for dealing with Lua
|
|
* @module
|
|
*/
|
|
"use strict";
|
|
|
|
/**
|
|
* Escapes a string for inclusion into a lua string
|
|
*
|
|
* @param {string} content - String to escape.
|
|
* @returns {string} Escaped string.
|
|
*/
|
|
function escapeString(content) {
|
|
return content
|
|
.replace(/\\/g, "\\\\")
|
|
.replace(/"/g, '\\"')
|
|
.replace(/'/g, "\\'")
|
|
.replace(/\0/g, "\\0")
|
|
.replace(/\n/g, "\\n")
|
|
.replace(/\r/g, "\\r")
|
|
;
|
|
}
|
|
|
|
module.exports = {
|
|
escapeString,
|
|
};
|