@tlua/gmod 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -0
- package/__metadata.json +4 -0
- package/_globals.d.tlua +178 -0
- package/_gmod-std.d.tlua +35 -0
- package/achievementicon.d.tlua +12 -0
- package/achievements.d.tlua +162 -0
- package/ai.d.tlua +65 -0
- package/ai_schedule.d.tlua +17 -0
- package/ai_task.d.tlua +17 -0
- package/angle.d.tlua +197 -0
- package/avatarimage.d.tlua +10 -0
- package/awesomium.d.tlua +14 -0
- package/baseclass.d.tlua +42 -0
- package/bf_read.d.tlua +110 -0
- package/bit.d.tlua +121 -0
- package/button.d.tlua +13 -0
- package/cam.d.tlua +220 -0
- package/ceffectdata.d.tlua +337 -0
- package/chat.d.tlua +62 -0
- package/checkbutton.d.tlua +14 -0
- package/cleanup.d.tlua +88 -0
- package/cluaemitter.d.tlua +119 -0
- package/clualocomotion.d.tlua +383 -0
- package/cluaparticle.d.tlua +426 -0
- package/cmovedata.d.tlua +476 -0
- package/cnavarea.d.tlua +845 -0
- package/cnavladder.d.tlua +209 -0
- package/cnewparticleeffect.d.tlua +259 -0
- package/color.d.tlua +339 -0
- package/concommand.d.tlua +69 -0
- package/constraint.d.tlua +311 -0
- package/construct.d.tlua +26 -0
- package/contentheader.d.tlua +32 -0
- package/contenticon.d.tlua +86 -0
- package/contentsidebar.d.tlua +45 -0
- package/contentsidebartoolbox.d.tlua +13 -0
- package/contextbase.d.tlua +37 -0
- package/controlpanel.d.tlua +140 -0
- package/controlpresets.d.tlua +118 -0
- package/convar.d.tlua +162 -0
- package/cookie.d.tlua +60 -0
- package/coroutine.d.tlua +90 -0
- package/crecipientfilter.d.tlua +152 -0
- package/csent.d.tlua +10 -0
- package/csoundpatch.d.tlua +150 -0
- package/ctakedamageinfo.d.tlua +366 -0
- package/ctrllistbox.d.tlua +12 -0
- package/ctrlnumpad.d.tlua +73 -0
- package/cusercmd.d.tlua +320 -0
- package/custom_classes.d.tlua +65 -0
- package/custom_entity_fields.d.tlua +96 -0
- package/cvars.d.tlua +80 -0
- package/dadjustablemodelpanel.d.tlua +81 -0
- package/dalphabar.d.tlua +27 -0
- package/dbinder.d.tlua +37 -0
- package/dbubblecontainer.d.tlua +18 -0
- package/dbutton.d.tlua +88 -0
- package/dcategoryheader.d.tlua +13 -0
- package/dcategorylist.d.tlua +11 -0
- package/dcheckbox.d.tlua +46 -0
- package/dcheckboxlabel.d.tlua +90 -0
- package/dcollapsiblecategory.d.tlua +240 -0
- package/dcolorbutton.d.tlua +73 -0
- package/dcolorcombo.d.tlua +54 -0
- package/dcolorcube.d.tlua +137 -0
- package/dcolormixer.d.tlua +303 -0
- package/dcolorpalette.d.tlua +294 -0
- package/dcolumnsheet.d.tlua +49 -0
- package/dcombobox.d.tlua +161 -0
- package/ddragbase.d.tlua +151 -0
- package/ddrawer.d.tlua +72 -0
- package/debug.d.tlua +236 -0
- package/debugoverlay.d.tlua +193 -0
- package/dentityproperties.d.tlua +63 -0
- package/derma.d.tlua +119 -0
- package/dexpandbutton.d.tlua +30 -0
- package/dfilebrowser.d.tlua +228 -0
- package/dform.d.tlua +176 -0
- package/dframe.d.tlua +261 -0
- package/dgrid.d.tlua +113 -0
- package/dhorizontaldivider.d.tlua +196 -0
- package/dhorizontalscroller.d.tlua +104 -0
- package/dhscrollbar.d.tlua +109 -0
- package/dhtml.d.tlua +91 -0
- package/dhtmlcontrols.d.tlua +62 -0
- package/diconbrowser.d.tlua +113 -0
- package/diconlayout.d.tlua +190 -0
- package/dimage.d.tlua +221 -0
- package/dimagebutton.d.tlua +103 -0
- package/dkillicon.d.tlua +9 -0
- package/dlabel.d.tlua +385 -0
- package/dlabeleditable.d.tlua +51 -0
- package/dlabelurl.d.tlua +100 -0
- package/dlistbox.d.tlua +82 -0
- package/dlistboxitem.d.tlua +42 -0
- package/dlistlayout.d.tlua +14 -0
- package/dlistview.d.tlua +360 -0
- package/dlistview_column.d.tlua +135 -0
- package/dlistview_columnplain.d.tlua +11 -0
- package/dlistview_draggerbar.d.tlua +11 -0
- package/dlistview_line.d.tlua +140 -0
- package/dlistviewheaderlabel.d.tlua +11 -0
- package/dlistviewlabel.d.tlua +11 -0
- package/dlistviewline.d.tlua +11 -0
- package/dmenu.d.tlua +266 -0
- package/dmenubar.d.tlua +42 -0
- package/dmenuoption.d.tlua +135 -0
- package/dmenuoptioncvar.d.tlua +64 -0
- package/dmodelpanel.d.tlua +207 -0
- package/dmodelselect.d.tlua +20 -0
- package/dmodelselectmulti.d.tlua +19 -0
- package/dnotify.d.tlua +93 -0
- package/dnumberscratch.d.tlua +284 -0
- package/dnumberwang.d.tlua +147 -0
- package/dnumpad.d.tlua +11 -0
- package/dnumslider.d.tlua +182 -0
- package/dpanel.d.tlua +152 -0
- package/dpanellist.d.tlua +109 -0
- package/dpaneloverlay.d.tlua +65 -0
- package/dpanelselect.d.tlua +13 -0
- package/dpanpanel.d.tlua +64 -0
- package/dprogress.d.tlua +27 -0
- package/dproperties.d.tlua +52 -0
- package/dproperty_boolean.d.tlua +12 -0
- package/dproperty_combo.d.tlua +31 -0
- package/dproperty_entity.d.tlua +12 -0
- package/dproperty_float.d.tlua +12 -0
- package/dproperty_generic.d.tlua +50 -0
- package/dproperty_int.d.tlua +12 -0
- package/dproperty_vectorcolor.d.tlua +14 -0
- package/dpropertysheet.d.tlua +167 -0
- package/dragndrop.d.tlua +123 -0
- package/draw.d.tlua +162 -0
- package/drgbpicker.d.tlua +49 -0
- package/drive.d.tlua +159 -0
- package/dscrollbargrip.d.tlua +13 -0
- package/dscrollpanel.d.tlua +110 -0
- package/dshape.d.tlua +72 -0
- package/dsizetocontents.d.tlua +46 -0
- package/dslider.d.tlua +302 -0
- package/dsprite.d.tlua +84 -0
- package/dtab.d.tlua +81 -0
- package/dtextentry.d.tlua +442 -0
- package/dtilelayout.d.tlua +218 -0
- package/dtooltip.d.tlua +76 -0
- package/dtree.d.tlua +185 -0
- package/dtree_node.d.tlua +793 -0
- package/dtree_node_button.d.tlua +13 -0
- package/duplicator.d.tlua +338 -0
- package/dverticaldivider.d.tlua +223 -0
- package/dvscrollbar.d.tlua +109 -0
- package/editablepanel.d.tlua +10 -0
- package/effect.d.tlua +121 -0
- package/effects.d.tlua +77 -0
- package/engine.d.tlua +248 -0
- package/entity.d.tlua +8295 -0
- package/ents.d.tlua +267 -0
- package/enums.d.tlua +7082 -0
- package/file.d.tlua +419 -0
- package/file_class.d.tlua +7 -0
- package/fingerposer.d.tlua +12 -0
- package/fingervar.d.tlua +13 -0
- package/frame.d.tlua +11 -0
- package/frame_blend.d.tlua +105 -0
- package/game.d.tlua +482 -0
- package/gameevent.d.tlua +968 -0
- package/gamemode.d.tlua +48 -0
- package/global.d.tlua +3156 -0
- package/gm.d.tlua +3218 -0
- package/gmod.d.tlua +20 -0
- package/gmsave.d.tlua +53 -0
- package/gui.d.tlua +232 -0
- package/gwen.d.tlua +55 -0
- package/halo.d.tlua +42 -0
- package/hammer.d.tlua +17 -0
- package/hook.d.tlua +64 -0
- package/html.d.tlua +22 -0
- package/http.d.tlua +72 -0
- package/iconeditor.d.tlua +130 -0
- package/igmodaudiochannel.d.tlua +419 -0
- package/imagecheckbox.d.tlua +48 -0
- package/imaterial.d.tlua +288 -0
- package/imesh.d.tlua +70 -0
- package/index.d.tlua +277 -0
- package/input.d.tlua +252 -0
- package/invalidateinternalentitycache.d.tlua +13 -0
- package/irestore.d.tlua +94 -0
- package/isave.d.tlua +94 -0
- package/itexture.d.tlua +108 -0
- package/ivideowriter.d.tlua +53 -0
- package/jit.d.tlua +243 -0
- package/killicon.d.tlua +84 -0
- package/label.d.tlua +20 -0
- package/language.d.tlua +26 -0
- package/list.d.tlua +112 -0
- package/makeballoon.d.tlua +15 -0
- package/markup.d.tlua +38 -0
- package/markupobject.d.tlua +53 -0
- package/material.d.tlua +9 -0
- package/math.d.tlua +899 -0
- package/matproxy.d.tlua +60 -0
- package/matselect.d.tlua +106 -0
- package/menu.d.tlua +20 -0
- package/menubar.d.tlua +39 -0
- package/mesh.d.tlua +183 -0
- package/modelimage.d.tlua +12 -0
- package/motionsensor.d.tlua +115 -0
- package/navmesh.d.tlua +274 -0
- package/net.d.tlua +639 -0
- package/nextbot.d.tlua +380 -0
- package/notification.d.tlua +35 -0
- package/npc.d.tlua +1787 -0
- package/numpad.d.tlua +89 -0
- package/os.d.tlua +56 -0
- package/package.d.tlua +15 -0
- package/package.json +18 -0
- package/panel.d.tlua +3650 -0
- package/panellist.d.tlua +13 -0
- package/pathfollower.d.tlua +301 -0
- package/permissions.d.tlua +77 -0
- package/physcollide.d.tlua +40 -0
- package/physenv.d.tlua +136 -0
- package/physobj.d.tlua +799 -0
- package/pixelvis_handle_t.d.tlua +9 -0
- package/player.d.tlua +3320 -0
- package/player_manager.d.tlua +147 -0
- package/preseteditor.d.tlua +13 -0
- package/presets.d.tlua +79 -0
- package/projectedtexture.d.tlua +553 -0
- package/properties.d.tlua +65 -0
- package/propselect.d.tlua +50 -0
- package/radiobutton.d.tlua +13 -0
- package/render.d.tlua +1700 -0
- package/resource.d.tlua +73 -0
- package/richtext.d.tlua +17 -0
- package/sandbox.d.tlua +576 -0
- package/saverestore.d.tlua +148 -0
- package/schedule.d.tlua +69 -0
- package/scripted_ents.d.tlua +124 -0
- package/search.d.tlua +26 -0
- package/serverlist.d.tlua +85 -0
- package/slidebar.d.tlua +12 -0
- package/slider.d.tlua +11 -0
- package/sound.d.tlua +140 -0
- package/spawnicon.d.tlua +95 -0
- package/spawnmenu.d.tlua +286 -0
- package/spawnmenucontentpanel.d.tlua +52 -0
- package/sql.d.tlua +154 -0
- package/stack.d.tlua +57 -0
- package/steamworks.d.tlua +208 -0
- package/string.d.tlua +535 -0
- package/structures.d.tlua +4442 -0
- package/surface.d.tlua +463 -0
- package/surfaceinfo.d.tlua +70 -0
- package/system.d.tlua +134 -0
- package/table.d.tlua +533 -0
- package/task.d.tlua +92 -0
- package/team.d.tlua +195 -0
- package/textentry.d.tlua +12 -0
- package/tgaimage.d.tlua +11 -0
- package/timer.d.tlua +198 -0
- package/tool.d.tlua +466 -0
- package/ugcpublishwindow.d.tlua +83 -0
- package/umsg.d.tlua +147 -0
- package/undo.d.tlua +122 -0
- package/urllabel.d.tlua +13 -0
- package/usermessage.d.tlua +48 -0
- package/utf8.d.tlua +89 -0
- package/util.d.tlua +1087 -0
- package/vector.d.tlua +413 -0
- package/vehicle.d.tlua +472 -0
- package/vgui.d.tlua +201 -0
- package/video.d.tlua +17 -0
- package/vmatrix.d.tlua +392 -0
- package/weapon.d.tlua +913 -0
- package/weapons.d.tlua +90 -0
- package/widgets.d.tlua +29 -0
- package/workshopfilebase.d.tlua +68 -0
package/string.d.tlua
ADDED
|
@@ -0,0 +1,535 @@
|
|
|
1
|
+
// AUTO-GENERATED tlua declarations. Do not edit by hand.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The string *type* is a sequence of characters.
|
|
5
|
+
*
|
|
6
|
+
* The string *library* is a standard Lua library which provides functions for the manipulation of strings.[[1]](https://www.lua.org/pil/20.html)
|
|
7
|
+
*
|
|
8
|
+
* In Garry's Mod there are several extra useful functions and features added to this library.
|
|
9
|
+
* Most notably all strings will access this library through the string metatable index function.[[2]](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/lua/includes/extensions/string.lua#L311-L322)
|
|
10
|
+
*
|
|
11
|
+
* This means all strings are treated like table objects and the string library as its [Meta Table](https://wiki.facepunch.com/gmod/Meta_Tables)
|
|
12
|
+
*
|
|
13
|
+
* ```lua
|
|
14
|
+
* local x = "Kittens"
|
|
15
|
+
* function string.Foobar(self) return self:Right(4) end
|
|
16
|
+
*
|
|
17
|
+
* string.Right(x,4) == x:Right(4) == x:Foobar() == ("Kittens"):Right(4) == x[-4]..x[-3]..x[-2]..x[-1]
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
* The string *metatable* however is something else, and to access that you must use `getmetatable("")`.
|
|
22
|
+
*
|
|
23
|
+
* The difference here is related to [Metamethods](https://wiki.facepunch.com/gmod/Metamethods), such as using (+) instead of (..) to concatenate strings.
|
|
24
|
+
* **WARNING**: Using `+` operator for concatenation breaks lua metamethod to sum string as numbers (Example: `"10" + "1"` return `11` (number)) and this is 400 times SLOWER!
|
|
25
|
+
*
|
|
26
|
+
*
|
|
27
|
+
* ```lua
|
|
28
|
+
* local stringmeta = getmetatable("")
|
|
29
|
+
* function stringmeta.__add(str,x) return str..x end -- This will work
|
|
30
|
+
* function string.__add(str,x) return str..x end -- But this will not.
|
|
31
|
+
*
|
|
32
|
+
* print("Kittens" + " And " + "Puppies")
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* See [Meta Tables](https://wiki.facepunch.com/gmod/Meta_Tables) and [Metamethods](https://wiki.facepunch.com/gmod/Metamethods) for more information.
|
|
36
|
+
* **WARNING**: Making changes to the string *metatable* is not a good idea unless you know what you are doing. Use the string *library* instead.
|
|
37
|
+
*
|
|
38
|
+
*
|
|
39
|
+
* This category lists functions available in the string *library*.
|
|
40
|
+
* @source https://wiki.facepunch.com/gmod/string
|
|
41
|
+
*/
|
|
42
|
+
interface StringLib {
|
|
43
|
+
/**
|
|
44
|
+
* Converts a cardinal (`111`) number to its [ordinal/sequential variation](https://en.wikipedia.org/wiki/Ordinal_numeral) (`111th`).
|
|
45
|
+
*
|
|
46
|
+
* See also [Global.STNDRD](https://wiki.facepunch.com/gmod/Global.STNDRD) for a function that returns just the suffix.
|
|
47
|
+
*
|
|
48
|
+
* @realm shared and menu
|
|
49
|
+
* @source https://wiki.facepunch.com/gmod/string.CardinalToOrdinal
|
|
50
|
+
*/
|
|
51
|
+
CardinalToOrdinal(input: number): string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface StringLib {
|
|
55
|
+
/**
|
|
56
|
+
* Inserts commas for every third digit of a given number.
|
|
57
|
+
* @realm shared and menu
|
|
58
|
+
* @source https://wiki.facepunch.com/gmod/string.Comma
|
|
59
|
+
*/
|
|
60
|
+
Comma(value: number, separator?: string): string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
interface StringLib {
|
|
64
|
+
/**
|
|
65
|
+
* Returns whether or not the second passed string matches the end of the first.
|
|
66
|
+
* @realm shared and menu
|
|
67
|
+
* @source https://wiki.facepunch.com/gmod/string.EndsWith
|
|
68
|
+
*/
|
|
69
|
+
EndsWith(str: string, _end: string): boolean;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface StringLib {
|
|
73
|
+
/**
|
|
74
|
+
* Splits a string up wherever it finds the given separator. string.Split is an
|
|
75
|
+
* alias of this, except that it doesn't support patterns.
|
|
76
|
+
*
|
|
77
|
+
* Literal inputs split into a precise tuple via `Split` (the tlua port of
|
|
78
|
+
* `std.Split`); a plain `string` input yields `string[]`.
|
|
79
|
+
* @realm shared
|
|
80
|
+
* @realm menu
|
|
81
|
+
* @source https://wiki.facepunch.com/gmod/string.Explode
|
|
82
|
+
*/
|
|
83
|
+
Explode<Sep extends string, Str extends string>(separator: ConstTpl<Sep>, str: ConstTpl<Str>, withpattern?: boolean): Split<Sep, Str>;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
interface StringLib {
|
|
88
|
+
/**
|
|
89
|
+
* Returns the time as a formatted string or as a table if no format is given.
|
|
90
|
+
* @realm shared and menu
|
|
91
|
+
* @source https://wiki.facepunch.com/gmod/string.FormattedTime
|
|
92
|
+
*/
|
|
93
|
+
FormattedTime(float: number, format?: string): string | FormattedTime;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
interface StringLib {
|
|
97
|
+
/**
|
|
98
|
+
* Creates a string from a Color variable.
|
|
99
|
+
* @realm shared and menu
|
|
100
|
+
* @source https://wiki.facepunch.com/gmod/string.FromColor
|
|
101
|
+
*/
|
|
102
|
+
FromColor(color: Color): string;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
interface StringLib {
|
|
106
|
+
/**
|
|
107
|
+
* Returns char value from the specified index in the supplied string.
|
|
108
|
+
* @realm shared and menu
|
|
109
|
+
* @source https://wiki.facepunch.com/gmod/string.GetChar
|
|
110
|
+
* @deprecated Use either string.sub(str, index, index) or str[index].
|
|
111
|
+
*/
|
|
112
|
+
GetChar(str: string, index: number): string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
interface StringLib {
|
|
116
|
+
/**
|
|
117
|
+
* Returns extension of the file.
|
|
118
|
+
*
|
|
119
|
+
* See [string.StripExtension](https://wiki.facepunch.com/gmod/string.StripExtension) for a function to remove the extension.
|
|
120
|
+
* See [string.GetFileFromFilename](https://wiki.facepunch.com/gmod/string.GetFileFromFilename) and [string.GetPathFromFilename](https://wiki.facepunch.com/gmod/string.GetPathFromFilename) for related functions.
|
|
121
|
+
*
|
|
122
|
+
* **NOTE**: Make sure there are no trailing whitespaces in your `path` argument
|
|
123
|
+
*
|
|
124
|
+
*
|
|
125
|
+
* @realm shared and menu
|
|
126
|
+
* @source https://wiki.facepunch.com/gmod/string.GetExtensionFromFilename
|
|
127
|
+
*/
|
|
128
|
+
GetExtensionFromFilename(path: string): string;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
interface StringLib {
|
|
132
|
+
/**
|
|
133
|
+
* Returns file name and extension.
|
|
134
|
+
*
|
|
135
|
+
* See [string.GetPathFromFilename](https://wiki.facepunch.com/gmod/string.GetPathFromFilename) for the opposite function.
|
|
136
|
+
* See [string.GetExtensionFromFilename](https://wiki.facepunch.com/gmod/string.GetExtensionFromFilename) for the file extension version.
|
|
137
|
+
*
|
|
138
|
+
* @realm shared and menu
|
|
139
|
+
* @source https://wiki.facepunch.com/gmod/string.GetFileFromFilename
|
|
140
|
+
*/
|
|
141
|
+
GetFileFromFilename(path: string): string;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
interface StringLib {
|
|
145
|
+
/**
|
|
146
|
+
* Returns the path part of a full file path.
|
|
147
|
+
*
|
|
148
|
+
* See [string.GetFileFromFilename](https://wiki.facepunch.com/gmod/string.GetFileFromFilename) for the opposite function.
|
|
149
|
+
* See [string.GetExtensionFromFilename](https://wiki.facepunch.com/gmod/string.GetExtensionFromFilename) for thefile extension version.
|
|
150
|
+
*
|
|
151
|
+
*
|
|
152
|
+
* @realm shared and menu
|
|
153
|
+
* @source https://wiki.facepunch.com/gmod/string.GetPathFromFilename
|
|
154
|
+
*/
|
|
155
|
+
GetPathFromFilename(path: string): string;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
interface StringLib {
|
|
159
|
+
/**
|
|
160
|
+
* Joins the values of a table together to form a string.
|
|
161
|
+
*
|
|
162
|
+
* This is the reverse of [string.Explode](https://wiki.facepunch.com/gmod/string.Explode) and is functionally identical to [table.concat](https://wiki.facepunch.com/gmod/table.concat), but with less features.
|
|
163
|
+
*
|
|
164
|
+
* @realm shared and menu
|
|
165
|
+
* @source https://wiki.facepunch.com/gmod/string.Implode
|
|
166
|
+
* @deprecated You really should just use table.concat.
|
|
167
|
+
*/
|
|
168
|
+
Implode(separator?: string, pieces?: table): string;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
interface StringLib {
|
|
172
|
+
/**
|
|
173
|
+
* Interpolates a given string with the given table. This is useful for formatting localized strings.
|
|
174
|
+
* @realm shared and menu
|
|
175
|
+
* @source https://wiki.facepunch.com/gmod/string.Interpolate
|
|
176
|
+
*/
|
|
177
|
+
Interpolate(str: string, lookuptable: table): string;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
interface StringLib {
|
|
181
|
+
/**
|
|
182
|
+
* Escapes special characters for JavaScript in a string, making the string safe for inclusion in to JavaScript strings.
|
|
183
|
+
* @realm shared and menu
|
|
184
|
+
* @source https://wiki.facepunch.com/gmod/string.JavascriptSafe
|
|
185
|
+
*/
|
|
186
|
+
JavascriptSafe(str: string): string;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
interface StringLib {
|
|
190
|
+
/**
|
|
191
|
+
* Returns everything left of supplied place of that string.
|
|
192
|
+
* @realm shared and menu
|
|
193
|
+
* @source https://wiki.facepunch.com/gmod/string.Left
|
|
194
|
+
*/
|
|
195
|
+
Left(str: string, num: number): string;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
interface StringLib {
|
|
199
|
+
/**
|
|
200
|
+
* Converts a `"string_likeThis"` to a more human-friendly `"String like This"`.
|
|
201
|
+
*
|
|
202
|
+
* This is used internally by Faceposer and other code to transform flex and bodygroup names to a more friendly format.
|
|
203
|
+
*
|
|
204
|
+
* @realm shared and menu
|
|
205
|
+
* @source https://wiki.facepunch.com/gmod/string.NiceName
|
|
206
|
+
*/
|
|
207
|
+
NiceName(text: string): string;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
interface StringLib {
|
|
211
|
+
/**
|
|
212
|
+
* Converts a digital filesize to human-readable text.
|
|
213
|
+
* @realm shared and menu
|
|
214
|
+
* @source https://wiki.facepunch.com/gmod/string.NiceSize
|
|
215
|
+
*/
|
|
216
|
+
NiceSize(bytes: number): string;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
interface StringLib {
|
|
220
|
+
/**
|
|
221
|
+
* Formats the supplied number (in seconds) to the highest possible time unit.
|
|
222
|
+
* @realm shared and menu
|
|
223
|
+
* @source https://wiki.facepunch.com/gmod/string.NiceTime
|
|
224
|
+
*/
|
|
225
|
+
NiceTime(num: number): string;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
interface StringLib {
|
|
229
|
+
/**
|
|
230
|
+
* Escapes all special characters within a string, making the string safe for inclusion in a Lua pattern.
|
|
231
|
+
* @realm shared and menu
|
|
232
|
+
* @source https://wiki.facepunch.com/gmod/string.PatternSafe
|
|
233
|
+
*/
|
|
234
|
+
PatternSafe(str: string): string;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
interface StringLib {
|
|
238
|
+
/**
|
|
239
|
+
* Replaces all occurrences of the supplied second string.
|
|
240
|
+
* @realm shared and menu
|
|
241
|
+
* @source https://wiki.facepunch.com/gmod/string.Replace
|
|
242
|
+
*/
|
|
243
|
+
Replace(str: string, find: string, replace: string): string;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
interface StringLib {
|
|
247
|
+
/**
|
|
248
|
+
* Returns the last n-th characters of the string.
|
|
249
|
+
* @realm shared and menu
|
|
250
|
+
* @source https://wiki.facepunch.com/gmod/string.Right
|
|
251
|
+
*/
|
|
252
|
+
Right(str: string, num: number): string;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
interface StringLib {
|
|
256
|
+
/**
|
|
257
|
+
* Sets the character at the specific index of the string.
|
|
258
|
+
* @realm shared and menu
|
|
259
|
+
* @source https://wiki.facepunch.com/gmod/string.SetChar
|
|
260
|
+
*/
|
|
261
|
+
SetChar(InputString: string, Index: number, ReplacementChar: string): string;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
interface StringLib {
|
|
265
|
+
/**
|
|
266
|
+
* Splits the string into a table of strings, separated by the second argument.
|
|
267
|
+
* An alias of string.Explode, but with flipped arguments.
|
|
268
|
+
*
|
|
269
|
+
* Literal inputs split into a precise tuple via `Split` (the tlua port of
|
|
270
|
+
* `std.Split`); a plain `string` input yields `string[]`.
|
|
271
|
+
* @realm shared
|
|
272
|
+
* @realm menu
|
|
273
|
+
* @source https://wiki.facepunch.com/gmod/string.Split
|
|
274
|
+
*/
|
|
275
|
+
Split<Sep extends string, Str extends string>(Inputstring: ConstTpl<Str>, Separator: ConstTpl<Sep>): Split<Sep, Str>;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
interface StringLib {
|
|
280
|
+
/**
|
|
281
|
+
* Returns whether or not the first string starts with the second. This is a alias of [string.StartsWith](https://wiki.facepunch.com/gmod/string.StartsWith).
|
|
282
|
+
* @realm shared and menu
|
|
283
|
+
* @source https://wiki.facepunch.com/gmod/string.StartWith
|
|
284
|
+
* @deprecated Use string.StartsWith.
|
|
285
|
+
*/
|
|
286
|
+
StartWith(inputStr: string, start: string): boolean;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
interface StringLib {
|
|
290
|
+
/**
|
|
291
|
+
* Returns whether or not the first string starts with the second.
|
|
292
|
+
* @realm shared and menu
|
|
293
|
+
* @source https://wiki.facepunch.com/gmod/string.StartsWith
|
|
294
|
+
*/
|
|
295
|
+
StartsWith(inputStr: string, start: string): boolean;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
interface StringLib {
|
|
299
|
+
/**
|
|
300
|
+
* Removes the extension of a path.
|
|
301
|
+
*
|
|
302
|
+
* See [string.GetExtensionFromFilename](https://wiki.facepunch.com/gmod/string.GetExtensionFromFilename) for a function to retrieve the extension instead.
|
|
303
|
+
*
|
|
304
|
+
* @realm shared and menu
|
|
305
|
+
* @source https://wiki.facepunch.com/gmod/string.StripExtension
|
|
306
|
+
*/
|
|
307
|
+
StripExtension(path: string): string;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
interface StringLib {
|
|
311
|
+
/**
|
|
312
|
+
* Attempts to create a Color from a string.
|
|
313
|
+
*
|
|
314
|
+
* @realm shared and menu
|
|
315
|
+
* @source https://wiki.facepunch.com/gmod/string.ToColor
|
|
316
|
+
*/
|
|
317
|
+
ToColor(colorString: string): Color;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
interface StringLib {
|
|
321
|
+
/**
|
|
322
|
+
* Returns given time in "MM:SS" format.
|
|
323
|
+
* @realm shared and menu
|
|
324
|
+
* @source https://wiki.facepunch.com/gmod/string.ToMinutesSeconds
|
|
325
|
+
*/
|
|
326
|
+
ToMinutesSeconds(time: number): string;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
interface StringLib {
|
|
330
|
+
/**
|
|
331
|
+
* Returns given time in "MM:SS:MS" format.
|
|
332
|
+
* @realm shared and menu
|
|
333
|
+
* @source https://wiki.facepunch.com/gmod/string.ToMinutesSecondsMilliseconds
|
|
334
|
+
*/
|
|
335
|
+
ToMinutesSecondsMilliseconds(time: number): string;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
interface StringLib {
|
|
339
|
+
/**
|
|
340
|
+
* Splits the string into characters and creates a sequential table of characters.
|
|
341
|
+
*
|
|
342
|
+
* **WARNING**: As a result of the encoding, non-ASCII characters will be split into more than one character in the output table. Each character value in the output table will always be 1 byte.
|
|
343
|
+
*
|
|
344
|
+
*
|
|
345
|
+
* @realm shared and menu
|
|
346
|
+
* @source https://wiki.facepunch.com/gmod/string.ToTable
|
|
347
|
+
*/
|
|
348
|
+
ToTable(str: string): table;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
interface StringLib {
|
|
352
|
+
/**
|
|
353
|
+
* Removes leading and trailing matches of a string.
|
|
354
|
+
* @realm shared and menu
|
|
355
|
+
* @source https://wiki.facepunch.com/gmod/string.Trim
|
|
356
|
+
*/
|
|
357
|
+
Trim(Inputstring: string, Char?: string): string;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
interface StringLib {
|
|
361
|
+
/**
|
|
362
|
+
* Removes leading spaces/characters from a string.
|
|
363
|
+
* @realm shared and menu
|
|
364
|
+
* @source https://wiki.facepunch.com/gmod/string.TrimLeft
|
|
365
|
+
*/
|
|
366
|
+
TrimLeft(str: string, char?: string): string;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
interface StringLib {
|
|
370
|
+
/**
|
|
371
|
+
* Removes trailing spaces/passed character from a string.
|
|
372
|
+
* @realm shared and menu
|
|
373
|
+
* @source https://wiki.facepunch.com/gmod/string.TrimRight
|
|
374
|
+
*/
|
|
375
|
+
TrimRight(str: string, char?: string): string;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
interface StringLib {
|
|
379
|
+
/**
|
|
380
|
+
* Returns the given string's characters in their numeric ASCII representation.
|
|
381
|
+
* **WARNING**: This function will throw an error if the slice length is greater than 8000 characters.
|
|
382
|
+
*
|
|
383
|
+
*
|
|
384
|
+
* @realm shared and menu
|
|
385
|
+
* @source https://wiki.facepunch.com/gmod/string.byte
|
|
386
|
+
*/
|
|
387
|
+
byte(string: string, startPos?: number, endPos?: number): (...any);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
interface StringLib {
|
|
391
|
+
/**
|
|
392
|
+
* Takes the given numerical bytes and converts them to a string.
|
|
393
|
+
* @realm shared and menu
|
|
394
|
+
* @source https://wiki.facepunch.com/gmod/string.char
|
|
395
|
+
*/
|
|
396
|
+
char(...: any): string;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
interface StringLib {
|
|
400
|
+
/**
|
|
401
|
+
* Returns the binary bytecode of the given function.
|
|
402
|
+
*
|
|
403
|
+
* **NOTE**: This does not work with functions created in C/C++. An error will be thrown if it is
|
|
404
|
+
*
|
|
405
|
+
*
|
|
406
|
+
* @realm shared and menu
|
|
407
|
+
* @source https://wiki.facepunch.com/gmod/string.dump
|
|
408
|
+
*/
|
|
409
|
+
dump(func: function, stripDebugInfo?: boolean): string;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
interface StringLib {
|
|
413
|
+
/**
|
|
414
|
+
* Attempts to find the specified substring in a string.
|
|
415
|
+
*
|
|
416
|
+
* **WARNING**: This function uses [Lua Patterns](https://wiki.facepunch.com/gmod/Patterns) by default.
|
|
417
|
+
*
|
|
418
|
+
*
|
|
419
|
+
* @realm shared and menu
|
|
420
|
+
* @source https://wiki.facepunch.com/gmod/string.find
|
|
421
|
+
*/
|
|
422
|
+
find(haystack: string, needle: string, startPos?: number, noPatterns?: boolean): (number, number, string);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
interface StringLib {
|
|
426
|
+
/**
|
|
427
|
+
* Formats the specified values into the string given.
|
|
428
|
+
* @realm shared and menu
|
|
429
|
+
* @source https://wiki.facepunch.com/gmod/string.format
|
|
430
|
+
*/
|
|
431
|
+
format(format: string, ...: any): string;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
interface StringLib {
|
|
435
|
+
/**
|
|
436
|
+
* Returns an iterator function that is called for every complete match of the pattern, all sub matches will be passed as to the loop.
|
|
437
|
+
* @realm shared and menu
|
|
438
|
+
* @source https://wiki.facepunch.com/gmod/string.gfind
|
|
439
|
+
* @deprecated This function is removed in Lua versions later than what GMod is currently using. Use string.gmatch instead.
|
|
440
|
+
*/
|
|
441
|
+
gfind(data: string, pattern: string): function;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
interface StringLib {
|
|
445
|
+
/**
|
|
446
|
+
* Using [Patterns](https://wiki.facepunch.com/gmod/Patterns), returns an iterator which will return either one value if no capture groups are defined, or any capture group matches.
|
|
447
|
+
* @realm shared and menu
|
|
448
|
+
* @source https://wiki.facepunch.com/gmod/string.gmatch
|
|
449
|
+
*/
|
|
450
|
+
gmatch(data: string, pattern: string): function;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
interface StringLib {
|
|
454
|
+
/**
|
|
455
|
+
* Replaces certain character sequences in a string using Patterns.
|
|
456
|
+
*
|
|
457
|
+
* The replacement may be a string, a table (matched sequence used as key), or a
|
|
458
|
+
* function (all matches passed as parameters; return value(s) used as replacement).
|
|
459
|
+
* @realm shared
|
|
460
|
+
* @realm menu
|
|
461
|
+
* @source https://wiki.facepunch.com/gmod/string.gsub
|
|
462
|
+
*/
|
|
463
|
+
gsub(string: string, pattern: string, replacement: string | table | ((...: string) => string), maxReplaces?: number): (string, number);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
interface StringLib {
|
|
468
|
+
/**
|
|
469
|
+
* Counts the number of characters in the string (length). This is equivalent to using the length operator (#).
|
|
470
|
+
* @realm shared and menu
|
|
471
|
+
* @source https://wiki.facepunch.com/gmod/string.len
|
|
472
|
+
*/
|
|
473
|
+
len(str: string): number;
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
interface StringLib {
|
|
477
|
+
/**
|
|
478
|
+
* Changes any upper-case letters in a string to lower-case letters.
|
|
479
|
+
* **NOTE**: This function doesn't work on special non-English UTF-8 characters.
|
|
480
|
+
*
|
|
481
|
+
*
|
|
482
|
+
* @realm shared and menu
|
|
483
|
+
* @source https://wiki.facepunch.com/gmod/string.lower
|
|
484
|
+
*/
|
|
485
|
+
lower(str: string): string;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
interface StringLib {
|
|
489
|
+
/**
|
|
490
|
+
* Finds a [Pattern](https://wiki.facepunch.com/gmod/Patterns) in a string.
|
|
491
|
+
* @realm shared and menu
|
|
492
|
+
* @source https://wiki.facepunch.com/gmod/string.match
|
|
493
|
+
*/
|
|
494
|
+
match(string: string, pattern: string, startPosition?: number): (...any);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
interface StringLib {
|
|
498
|
+
/**
|
|
499
|
+
* Repeats a string by the provided number, with an optional separator.
|
|
500
|
+
* @realm shared and menu
|
|
501
|
+
* @source https://wiki.facepunch.com/gmod/string.rep
|
|
502
|
+
*/
|
|
503
|
+
rep(str: string, repetitions: number, separator?: string): string;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
interface StringLib {
|
|
507
|
+
/**
|
|
508
|
+
* Reverses a string.
|
|
509
|
+
* @realm shared and menu
|
|
510
|
+
* @source https://wiki.facepunch.com/gmod/string.reverse
|
|
511
|
+
*/
|
|
512
|
+
reverse(str: string): string;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
interface StringLib {
|
|
516
|
+
/**
|
|
517
|
+
* Returns a sub-string, starting from the character at position `StartPos` of the string (inclusive), and optionally ending at the character at position `EndPos` of the string (also inclusive). If EndPos is not given, the rest of the string is returned.
|
|
518
|
+
* @realm shared and menu
|
|
519
|
+
* @source https://wiki.facepunch.com/gmod/string.sub
|
|
520
|
+
*/
|
|
521
|
+
sub(string: string, StartPos: number, EndPos?: number): string;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
interface StringLib {
|
|
525
|
+
/**
|
|
526
|
+
* Changes any lower-case letters in a string to upper-case letters.
|
|
527
|
+
* **NOTE**: This function doesn't work on special non-English UTF-8 characters.
|
|
528
|
+
*
|
|
529
|
+
*
|
|
530
|
+
* @realm shared and menu
|
|
531
|
+
* @source https://wiki.facepunch.com/gmod/string.upper
|
|
532
|
+
*/
|
|
533
|
+
upper(str: string): string;
|
|
534
|
+
}
|
|
535
|
+
|