mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-17 15:33:12 +09:00
Port basic lib modules to TypeScript
This commit is contained in:
1 parent
2988cd962c
commit
e0c197b9bc
25 files changed
+1370
-1324
No files matched your search
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Utilities for dealing with Lua
|
||||
* @module lib/lua_tools
|
||||
*/
|
||||
|
||||
/**
|
||||
* Escapes a string for inclusion into a lua string
|
||||
*
|
||||
* @param content - String to escape.
|
||||
* @returns Escaped string.
|
||||
*/
|
||||
export function escapeString(content: string) {
|
||||
return content
|
||||
.replace(/\\/g, "\\\\")
|
||||
.replace(/"/g, '\\"')
|
||||
.replace(/'/g, "\\'")
|
||||
.replace(/\0/g, "\\0")
|
||||
.replace(/\n/g, "\\n")
|
||||
.replace(/\r/g, "\\r")
|
||||
;
|
||||
}
|
||||
Reference in new issue
Block a user