mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 07:04:52 +09:00
Fix module names, which are incorrectly deduced by JSDoc, and references to master, slave and ctl modules that are now in separate packages.
27 lines
469 B
JavaScript
27 lines
469 B
JavaScript
/**
|
|
* Utilities for dealing with Lua
|
|
* @module lib/luaTools
|
|
*/
|
|
"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,
|
|
};
|