@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/table.d.tlua
ADDED
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
// AUTO-GENERATED tlua declarations. Do not edit by hand.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The [table](https://wiki.facepunch.com/gmod/Beginner_Tutorial_Tables) **type** is an object that can store multiple values.
|
|
5
|
+
*
|
|
6
|
+
* The table **library** is a standard Lua library which provides functions to manipulate tables. In Garry's Mod there are several extra useful functions added to this library.
|
|
7
|
+
*
|
|
8
|
+
* This category lists the functions available in the table `library`.
|
|
9
|
+
* @source https://wiki.facepunch.com/gmod/table
|
|
10
|
+
*/
|
|
11
|
+
interface TableLib {
|
|
12
|
+
/**
|
|
13
|
+
* Adds all values from `source` table into the `target` table. This is most useful for sequential tables, not "dictionary" or "map" tables. See [table.Merge](https://wiki.facepunch.com/gmod/table.Merge) if you want to merge 2 tables into one.
|
|
14
|
+
*
|
|
15
|
+
* See [table.insert](https://wiki.facepunch.com/gmod/table.insert) for a function that adds a single value, and [table.Inherit](https://wiki.facepunch.com/gmod/table.Inherit) for a function that inherits keys from one table to another.
|
|
16
|
+
*
|
|
17
|
+
* @realm shared and menu
|
|
18
|
+
* @source https://wiki.facepunch.com/gmod/table.Add
|
|
19
|
+
*/
|
|
20
|
+
Add(target: table, source: table): table;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface TableLib {
|
|
24
|
+
/**
|
|
25
|
+
* Changes all keys to sequential integers. This creates a new table object and does not affect the original.
|
|
26
|
+
* @realm shared and menu
|
|
27
|
+
* @source https://wiki.facepunch.com/gmod/table.ClearKeys
|
|
28
|
+
*/
|
|
29
|
+
ClearKeys(table: table, saveKeys?: boolean): table;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface TableLib {
|
|
33
|
+
/**
|
|
34
|
+
* Collapses a table with keyvalue structure
|
|
35
|
+
* @realm shared and menu
|
|
36
|
+
* @source https://wiki.facepunch.com/gmod/table.CollapseKeyValue
|
|
37
|
+
*/
|
|
38
|
+
CollapseKeyValue(input: table): table;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface TableLib {
|
|
42
|
+
/**
|
|
43
|
+
* Creates and returns a deep copy of a table.
|
|
44
|
+
*
|
|
45
|
+
* WARNING: this function is very slow, and does NOT copy userdata such as
|
|
46
|
+
* Vectors and Angles.
|
|
47
|
+
* @realm shared
|
|
48
|
+
* @realm menu
|
|
49
|
+
* @source https://wiki.facepunch.com/gmod/table.Copy
|
|
50
|
+
*/
|
|
51
|
+
Copy<T extends table>(originalTable: T): T;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
interface TableLib {
|
|
56
|
+
/**
|
|
57
|
+
* Empties the target table, and merges all values from the source table into it.
|
|
58
|
+
* @realm shared and menu
|
|
59
|
+
* @source https://wiki.facepunch.com/gmod/table.CopyFromTo
|
|
60
|
+
*/
|
|
61
|
+
CopyFromTo(source: table, target: table): void;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface TableLib {
|
|
65
|
+
/**
|
|
66
|
+
* Counts the amount of keys in a table. This should only be used when a table is not numerically and sequentially indexed. For those tables, consider the length (**#**) operator.
|
|
67
|
+
*
|
|
68
|
+
* If you only want to test if the table is empty or not, use [table.IsEmpty](https://wiki.facepunch.com/gmod/table.IsEmpty) instead as it is a lot faster.
|
|
69
|
+
*
|
|
70
|
+
* @realm shared and menu
|
|
71
|
+
* @source https://wiki.facepunch.com/gmod/table.Count
|
|
72
|
+
*/
|
|
73
|
+
Count(tbl: table): number;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface TableLib {
|
|
77
|
+
/**
|
|
78
|
+
* Converts a table that has been sanitised with [table.Sanitise](https://wiki.facepunch.com/gmod/table.Sanitise) back to its original form
|
|
79
|
+
* @realm shared and menu
|
|
80
|
+
* @source https://wiki.facepunch.com/gmod/table.DeSanitise
|
|
81
|
+
*/
|
|
82
|
+
DeSanitise(tbl: table): table;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
interface TableLib {
|
|
86
|
+
/**
|
|
87
|
+
* Removes all values from a table. If your table is not a metatable, it is almost always better to use `tab = {}` to preserve performance.
|
|
88
|
+
* @realm shared and menu
|
|
89
|
+
* @source https://wiki.facepunch.com/gmod/table.Empty
|
|
90
|
+
*/
|
|
91
|
+
Empty(tbl: table): void;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
interface TableLib {
|
|
95
|
+
/**
|
|
96
|
+
* Returns the value positioned after the supplied value in a table. If it isn't found then the first element in the table is returned
|
|
97
|
+
*
|
|
98
|
+
* @realm shared and menu
|
|
99
|
+
* @source https://wiki.facepunch.com/gmod/table.FindNext
|
|
100
|
+
* @deprecated Instead, iterate the table using ipairs or increment from the previous index using Global.next. Non-numerically indexed tables are not ordered.
|
|
101
|
+
*/
|
|
102
|
+
FindNext(tbl: table, value: any): any;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
interface TableLib {
|
|
106
|
+
/**
|
|
107
|
+
* Returns the value positioned before the supplied value in a table. If it isn't found then the last element in the table is returned
|
|
108
|
+
*
|
|
109
|
+
* @realm shared and menu
|
|
110
|
+
* @source https://wiki.facepunch.com/gmod/table.FindPrev
|
|
111
|
+
* @deprecated Instead, iterate your table with ipairs, storing the previous value and checking for the target. Non-numerically indexed tables are not ordered.
|
|
112
|
+
*/
|
|
113
|
+
FindPrev(tbl: table, value: any): any;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface TableLib {
|
|
117
|
+
/**
|
|
118
|
+
* Flips key-value pairs of each element within a table, so that each value becomes the key, and each key becomes the value.
|
|
119
|
+
*
|
|
120
|
+
* **WARNING**: Take care when using this function, as a Lua table cannot contain multiple instances of the same key. As such, data loss is possible when using this function on tables with duplicate values.
|
|
121
|
+
*
|
|
122
|
+
* ```
|
|
123
|
+
* local test = { test = 1, test2 = 1 }
|
|
124
|
+
* local f = table.Flip( test )
|
|
125
|
+
* PrintTable( f )
|
|
126
|
+
* -- Outputs "1 = test2"
|
|
127
|
+
* ```
|
|
128
|
+
*
|
|
129
|
+
*
|
|
130
|
+
* @realm shared and menu
|
|
131
|
+
* @source https://wiki.facepunch.com/gmod/table.Flip
|
|
132
|
+
*/
|
|
133
|
+
Flip(input: table): table;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
interface TableLib {
|
|
137
|
+
/**
|
|
138
|
+
* Inserts a value in to the given table even if the table is non-existent
|
|
139
|
+
* @realm shared and menu
|
|
140
|
+
* @source https://wiki.facepunch.com/gmod/table.ForceInsert
|
|
141
|
+
*/
|
|
142
|
+
ForceInsert(tab?: table, value?: any): table;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
interface TableLib {
|
|
146
|
+
/**
|
|
147
|
+
* Returns the first key found in the given table
|
|
148
|
+
*
|
|
149
|
+
* @realm shared and menu
|
|
150
|
+
* @source https://wiki.facepunch.com/gmod/table.GetFirstKey
|
|
151
|
+
* @deprecated Instead, expect the first key to be 1. Non-numerically indexed tables are not ordered and do not have a first key.
|
|
152
|
+
*/
|
|
153
|
+
GetFirstKey(tab: table): any;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
interface TableLib {
|
|
157
|
+
/**
|
|
158
|
+
* Returns the first value found in the given table
|
|
159
|
+
*
|
|
160
|
+
* @realm shared and menu
|
|
161
|
+
* @source https://wiki.facepunch.com/gmod/table.GetFirstValue
|
|
162
|
+
* @deprecated Instead, index the table with a key of 1. Non-numerically indexed tables are not ordered and do not have a first key.
|
|
163
|
+
*/
|
|
164
|
+
GetFirstValue(tab: table): any;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
interface TableLib {
|
|
168
|
+
/**
|
|
169
|
+
* Returns all keys of a table.
|
|
170
|
+
* @realm shared and menu
|
|
171
|
+
* @source https://wiki.facepunch.com/gmod/table.GetKeys
|
|
172
|
+
*/
|
|
173
|
+
GetKeys(tabl: table): table;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
interface TableLib {
|
|
177
|
+
/**
|
|
178
|
+
* Returns the last key found in the given table
|
|
179
|
+
*
|
|
180
|
+
* @realm shared and menu
|
|
181
|
+
* @source https://wiki.facepunch.com/gmod/table.GetLastKey
|
|
182
|
+
* @deprecated Instead, use the result of the length (#) operator, ensuring it is not zero. Non-numerically indexed tables are not ordered and do not have a last key.
|
|
183
|
+
*/
|
|
184
|
+
GetLastKey(tab: table): any;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
interface TableLib {
|
|
188
|
+
/**
|
|
189
|
+
* Returns the last value found in the given table
|
|
190
|
+
*
|
|
191
|
+
* @realm shared and menu
|
|
192
|
+
* @source https://wiki.facepunch.com/gmod/table.GetLastValue
|
|
193
|
+
* @deprecated Instead, index the table with the result of the length (#) operator, ensuring it is not zero. Non-numerically indexed tables are not ordered and do not have a last key.
|
|
194
|
+
*/
|
|
195
|
+
GetLastValue(tab: table): any;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
interface TableLib {
|
|
199
|
+
/**
|
|
200
|
+
* Returns a key of the supplied table with the highest number value.
|
|
201
|
+
* @realm shared and menu
|
|
202
|
+
* @source https://wiki.facepunch.com/gmod/table.GetWinningKey
|
|
203
|
+
*/
|
|
204
|
+
GetWinningKey(inputTable: table): any;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
interface TableLib {
|
|
208
|
+
/**
|
|
209
|
+
* Checks if a table has a value.
|
|
210
|
+
* **WARNING**: This function is **very inefficient for large tables** (O(n)) and should probably not be called in things that run each frame. Instead, consider a table structure such as example 2 below. Also see: [Tables: Bad Habits](https://wiki.facepunch.com/gmod/Tables:_Bad_Habits)
|
|
211
|
+
*
|
|
212
|
+
* **NOTE**: For optimization, functions that look for a value by sorting the table should never be needed if you work on a table that you built yourself.
|
|
213
|
+
*
|
|
214
|
+
*
|
|
215
|
+
* @realm shared and menu
|
|
216
|
+
* @source https://wiki.facepunch.com/gmod/table.HasValue
|
|
217
|
+
*/
|
|
218
|
+
HasValue(tbl: table, value: any): boolean;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
interface TableLib {
|
|
222
|
+
/**
|
|
223
|
+
* Copies any missing data from `base` to `target`, and sets the `target`'s `BaseClass` member to the `base` table's pointer.
|
|
224
|
+
*
|
|
225
|
+
* See [table.Merge](https://wiki.facepunch.com/gmod/table.Merge), which overrides existing values and doesn't add a BaseClass member.
|
|
226
|
+
*
|
|
227
|
+
*
|
|
228
|
+
* See also [table.Add](https://wiki.facepunch.com/gmod/table.Add), which simply adds values of one table to another.
|
|
229
|
+
*
|
|
230
|
+
* Sub-tables aren't inherited. The target's table value will take priority.
|
|
231
|
+
*
|
|
232
|
+
* @realm shared and menu
|
|
233
|
+
* @source https://wiki.facepunch.com/gmod/table.Inherit
|
|
234
|
+
*/
|
|
235
|
+
Inherit(target: table, base: table): table;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
interface TableLib {
|
|
239
|
+
/**
|
|
240
|
+
* Returns whether or not the given table is empty.
|
|
241
|
+
*
|
|
242
|
+
* This works on both sequential and non-sequential tables, and is a lot faster for non-sequential tables than `table.Count(tbl) == 0`.
|
|
243
|
+
*
|
|
244
|
+
* For sequential tables it is better to use `tab[1] == nil`.
|
|
245
|
+
*
|
|
246
|
+
* @realm shared and menu
|
|
247
|
+
* @source https://wiki.facepunch.com/gmod/table.IsEmpty
|
|
248
|
+
*/
|
|
249
|
+
IsEmpty(tab: table): boolean;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
interface TableLib {
|
|
253
|
+
/**
|
|
254
|
+
* Returns whether or not the table's keys are sequential
|
|
255
|
+
* @realm shared and menu
|
|
256
|
+
* @source https://wiki.facepunch.com/gmod/table.IsSequential
|
|
257
|
+
*/
|
|
258
|
+
IsSequential(tab: table): boolean;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
interface TableLib {
|
|
262
|
+
/**
|
|
263
|
+
* Returns the first key found to be containing the supplied value
|
|
264
|
+
* @realm shared and menu
|
|
265
|
+
* @source https://wiki.facepunch.com/gmod/table.KeyFromValue
|
|
266
|
+
*/
|
|
267
|
+
KeyFromValue(tab: table, value: any): any;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
interface TableLib {
|
|
271
|
+
/**
|
|
272
|
+
* Returns a table of keys containing the supplied value
|
|
273
|
+
* @realm shared and menu
|
|
274
|
+
* @source https://wiki.facepunch.com/gmod/table.KeysFromValue
|
|
275
|
+
*/
|
|
276
|
+
KeysFromValue(tab: table, value: any): table;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
interface TableLib {
|
|
280
|
+
/**
|
|
281
|
+
* Returns a copy of the input table with all string keys converted to be lowercase recursively
|
|
282
|
+
* @realm shared and menu
|
|
283
|
+
* @source https://wiki.facepunch.com/gmod/table.LowerKeyNames
|
|
284
|
+
*/
|
|
285
|
+
LowerKeyNames(tbl: table): table;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
interface TableLib {
|
|
289
|
+
/**
|
|
290
|
+
* Returns an array of values of given with given key from each table of given table.
|
|
291
|
+
*
|
|
292
|
+
* See also [table.KeysFromValue](https://wiki.facepunch.com/gmod/table.KeysFromValue).
|
|
293
|
+
* @realm shared and menu
|
|
294
|
+
* @source https://wiki.facepunch.com/gmod/table.MemberValuesFromKey
|
|
295
|
+
*/
|
|
296
|
+
MemberValuesFromKey(inputTable: table, keyName: any): table;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
interface TableLib {
|
|
300
|
+
/**
|
|
301
|
+
* **NOTE**: This function can cause a stack overflow under certain circumstances.
|
|
302
|
+
*
|
|
303
|
+
* Recursively merges the key-value pairs of the `source` table with the key-value pairs in the `destination` table.
|
|
304
|
+
*
|
|
305
|
+
* See [table.Inherit](https://wiki.facepunch.com/gmod/table.Inherit), which doesn't override existing values.
|
|
306
|
+
*
|
|
307
|
+
*
|
|
308
|
+
* See also [table.Add](https://wiki.facepunch.com/gmod/table.Add), which simply adds values of one table to another.
|
|
309
|
+
*
|
|
310
|
+
*
|
|
311
|
+
* @realm shared and menu
|
|
312
|
+
* @source https://wiki.facepunch.com/gmod/table.Merge
|
|
313
|
+
*/
|
|
314
|
+
Merge(destination: table, source: table, forceOverride?: boolean): table;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
interface TableLib {
|
|
318
|
+
/**
|
|
319
|
+
* Packs a set of items into a table and returns the new table. It is meant as an alternative implementation of `table.pack` from newer versions of Lua.
|
|
320
|
+
*
|
|
321
|
+
* @realm shared and menu
|
|
322
|
+
* @source https://wiki.facepunch.com/gmod/table.Pack
|
|
323
|
+
*/
|
|
324
|
+
Pack(...: any): (table, number);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
interface TableLib {
|
|
328
|
+
/**
|
|
329
|
+
* Returns a random value from the supplied table.
|
|
330
|
+
*
|
|
331
|
+
* **WARNING**: This function iterates over the given table **twice**, therefore with sequential tables you should instead use following:
|
|
332
|
+
*
|
|
333
|
+
* ```
|
|
334
|
+
* mytable[ math.random( #mytable ) ]
|
|
335
|
+
* ```
|
|
336
|
+
*
|
|
337
|
+
*
|
|
338
|
+
* @realm shared and menu
|
|
339
|
+
* @source https://wiki.facepunch.com/gmod/table.Random
|
|
340
|
+
*/
|
|
341
|
+
Random(haystack: table): (any, any);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
interface TableLib {
|
|
345
|
+
/**
|
|
346
|
+
* Removes the first instance of a given value from the specified table with [table.remove](https://wiki.facepunch.com/gmod/table.remove), then returns the key that the value was found at.
|
|
347
|
+
*
|
|
348
|
+
* **WARNING**: Avoid usage of this function. It does not remove all instances of given value in the table, only the first found, and it does not work with non sequential tables!
|
|
349
|
+
*
|
|
350
|
+
* @realm shared and menu
|
|
351
|
+
* @source https://wiki.facepunch.com/gmod/table.RemoveByValue
|
|
352
|
+
*/
|
|
353
|
+
RemoveByValue(tbl: table, val: any): any;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
interface TableLib {
|
|
357
|
+
/**
|
|
358
|
+
* Returns a reversed copy of a sequential table. Any non-sequential and non-numeric keyvalue pairs will not be copied.
|
|
359
|
+
* @realm shared and menu
|
|
360
|
+
* @source https://wiki.facepunch.com/gmod/table.Reverse
|
|
361
|
+
*/
|
|
362
|
+
Reverse(tbl: table): table;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
interface TableLib {
|
|
366
|
+
/**
|
|
367
|
+
* Converts [Vector](https://wiki.facepunch.com/gmod/Vector)s, [Angle](https://wiki.facepunch.com/gmod/Angle)s and [boolean](https://wiki.facepunch.com/gmod/boolean)s to be able to be converted to and from key-values via [util.TableToKeyValues](https://wiki.facepunch.com/gmod/util.TableToKeyValues).
|
|
368
|
+
*
|
|
369
|
+
* [table.DeSanitise](https://wiki.facepunch.com/gmod/table.DeSanitise) performs the opposite transformation.
|
|
370
|
+
* @realm shared and menu
|
|
371
|
+
* @source https://wiki.facepunch.com/gmod/table.Sanitise
|
|
372
|
+
*/
|
|
373
|
+
Sanitise(tab: table): table;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
interface TableLib {
|
|
377
|
+
/**
|
|
378
|
+
* Performs an inline [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle) on the table in `O(n)` time
|
|
379
|
+
*
|
|
380
|
+
* @realm shared and menu
|
|
381
|
+
* @source https://wiki.facepunch.com/gmod/table.Shuffle
|
|
382
|
+
*/
|
|
383
|
+
Shuffle(target: table): void;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
interface TableLib {
|
|
387
|
+
/**
|
|
388
|
+
* Returns a list of keys sorted based on values of those keys.
|
|
389
|
+
*
|
|
390
|
+
* For normal sorting see [table.sort](https://wiki.facepunch.com/gmod/table.sort).
|
|
391
|
+
*
|
|
392
|
+
* @realm shared and menu
|
|
393
|
+
* @source https://wiki.facepunch.com/gmod/table.SortByKey
|
|
394
|
+
*/
|
|
395
|
+
SortByKey(tab: table, descending?: boolean): table;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
interface TableLib {
|
|
399
|
+
/**
|
|
400
|
+
* Sorts a table by a named member.
|
|
401
|
+
* @realm shared and menu
|
|
402
|
+
* @source https://wiki.facepunch.com/gmod/table.SortByMember
|
|
403
|
+
*/
|
|
404
|
+
SortByMember(tab: table, memberKey: any, ascending?: boolean): void;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
interface TableLib {
|
|
408
|
+
/**
|
|
409
|
+
* Sorts a table in reverse order from [table.sort](https://wiki.facepunch.com/gmod/table.sort).
|
|
410
|
+
* **NOTE**: This function modifies the table you give to it. Like table.sort, it does not return anything.
|
|
411
|
+
*
|
|
412
|
+
*
|
|
413
|
+
* @realm shared and menu
|
|
414
|
+
* @source https://wiki.facepunch.com/gmod/table.SortDesc
|
|
415
|
+
*/
|
|
416
|
+
SortDesc(tbl: table): void;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
interface TableLib {
|
|
420
|
+
/**
|
|
421
|
+
* Converts a table into a string
|
|
422
|
+
* @realm shared and menu
|
|
423
|
+
* @source https://wiki.facepunch.com/gmod/table.ToString
|
|
424
|
+
*/
|
|
425
|
+
ToString(tbl: table, displayName?: string, niceFormatting?: boolean): string;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
interface TableLib {
|
|
429
|
+
/**
|
|
430
|
+
* Concatenates the contents of a table to a string.
|
|
431
|
+
* @realm shared and menu
|
|
432
|
+
* @source https://wiki.facepunch.com/gmod/table.concat
|
|
433
|
+
*/
|
|
434
|
+
concat(tbl: table, concatenator?: string, startPos?: number, endPos?: number): string;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
interface TableLib {
|
|
438
|
+
/**
|
|
439
|
+
* Iterates for each key-value pair in the table, calling the function with the key and value of the pair. If the function returns anything, the loop is broken.
|
|
440
|
+
*
|
|
441
|
+
* The GLua interpretation of this is [table.ForEach](https://wiki.facepunch.com/gmod/table.ForEach).
|
|
442
|
+
*
|
|
443
|
+
* @realm shared and menu
|
|
444
|
+
* @source https://wiki.facepunch.com/gmod/table.foreach
|
|
445
|
+
* @deprecated This was deprecated in Lua 5.1 and removed in 5.2. You should use Global.pairs instead.
|
|
446
|
+
*/
|
|
447
|
+
ForEach(tbl: table, callback: (key: any, val: any) => void): void;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
interface TableLib {
|
|
451
|
+
/**
|
|
452
|
+
* Iterates for each numeric index in the table in order.
|
|
453
|
+
*
|
|
454
|
+
* This is inherited from the original Lua implementation and is deprecated in Lua as of 5.1; see [here](http://lua-users.org/wiki/TableLibraryTutorial). You should use [Global.ipairs](https://wiki.facepunch.com/gmod/Global.ipairs)() instead.
|
|
455
|
+
*
|
|
456
|
+
* @realm shared and menu
|
|
457
|
+
* @source https://wiki.facepunch.com/gmod/table.foreachi
|
|
458
|
+
* @deprecated This was deprecated in Lua 5.1 and removed in 5.2. You should use Global.ipairs() instead.
|
|
459
|
+
*/
|
|
460
|
+
foreachi(table: table, func: function): void;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
interface TableLib {
|
|
464
|
+
/**
|
|
465
|
+
* Returns the length of the table.
|
|
466
|
+
* @realm shared and menu
|
|
467
|
+
* @source https://wiki.facepunch.com/gmod/table.getn
|
|
468
|
+
* @deprecated This function was deprecated in Lua 5.1 and is removed in 5.2. Use the length (#) operator instead.
|
|
469
|
+
*/
|
|
470
|
+
getn(tbl: table): number;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
interface TableLib {
|
|
474
|
+
/**
|
|
475
|
+
* Inserts a value at the end of the table.
|
|
476
|
+
* @realm shared
|
|
477
|
+
* @realm menu
|
|
478
|
+
* @source https://wiki.facepunch.com/gmod/table.insert
|
|
479
|
+
*/
|
|
480
|
+
insert(tbl: table, value: any): number;
|
|
481
|
+
/**
|
|
482
|
+
* Inserts a value into a table at the given position.
|
|
483
|
+
*
|
|
484
|
+
* NOTE: does not call the `__newindex` metamethod.
|
|
485
|
+
* @realm shared
|
|
486
|
+
* @realm menu
|
|
487
|
+
*/
|
|
488
|
+
insert(tbl: table, position: number, value: any): number;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
interface TableLib {
|
|
493
|
+
/**
|
|
494
|
+
* Returns the highest numerical key.
|
|
495
|
+
* @realm shared and menu
|
|
496
|
+
* @source https://wiki.facepunch.com/gmod/table.maxn
|
|
497
|
+
*/
|
|
498
|
+
maxn(tbl: table): number;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
interface TableLib {
|
|
502
|
+
/**
|
|
503
|
+
* Moves elements from one part of a table to another part a given table. This is similar to assigning elements from the source table to the destination table in multiple assignments.
|
|
504
|
+
*
|
|
505
|
+
* @realm shared and menu
|
|
506
|
+
* @source https://wiki.facepunch.com/gmod/table.move
|
|
507
|
+
*/
|
|
508
|
+
move(sourceTbl: table, from: number, to: number, dest: number, destTbl?: table): table;
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
interface TableLib {
|
|
512
|
+
/**
|
|
513
|
+
* Removes a value from a table and shifts any other values down to fill the gap.
|
|
514
|
+
* **NOTE**: Does nothing if index is less than 1 or greater than `#tbl`
|
|
515
|
+
*
|
|
516
|
+
* @realm shared and menu
|
|
517
|
+
* @source https://wiki.facepunch.com/gmod/table.remove
|
|
518
|
+
*/
|
|
519
|
+
remove(tbl: table, index?: number): any;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
interface TableLib {
|
|
523
|
+
/**
|
|
524
|
+
* Sorts a sequential table either ascending or by the given sort function.
|
|
525
|
+
* **NOTE**: This function modifies the table you give to it and internally uses the [quick sort algorithm](http://www.lua.org/source/5.2/ltablib.c.html#sort).
|
|
526
|
+
*
|
|
527
|
+
*
|
|
528
|
+
* @realm shared and menu
|
|
529
|
+
* @source https://wiki.facepunch.com/gmod/table.sort
|
|
530
|
+
*/
|
|
531
|
+
sort(tbl: table, sorter?: (a: any, b: any) => boolean): void;
|
|
532
|
+
}
|
|
533
|
+
|
package/task.d.tlua
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// AUTO-GENERATED tlua declarations. Do not edit by hand.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A single AI task. Returned by [ai_task.New](https://wiki.facepunch.com/gmod/ai_task.New).
|
|
5
|
+
* @source https://wiki.facepunch.com/gmod/Task
|
|
6
|
+
*/
|
|
7
|
+
interface Task {}
|
|
8
|
+
|
|
9
|
+
interface Task {
|
|
10
|
+
/**
|
|
11
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
12
|
+
* Initialises the AI task. Called by [ai_task.New](https://wiki.facepunch.com/gmod/ai_task.New).
|
|
13
|
+
* @realm server
|
|
14
|
+
* @source https://wiki.facepunch.com/gmod/Task:Init
|
|
15
|
+
*/
|
|
16
|
+
Init(self: Task): void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface Task {
|
|
20
|
+
/**
|
|
21
|
+
* Initialises the AI task as an engine task.
|
|
22
|
+
* @realm server
|
|
23
|
+
* @source https://wiki.facepunch.com/gmod/Task:InitEngine
|
|
24
|
+
*/
|
|
25
|
+
InitEngine(self: Task, taskname: string, taskdata: number): void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface Task {
|
|
29
|
+
/**
|
|
30
|
+
* Initialises the AI task as NPC method-based.
|
|
31
|
+
* @realm server
|
|
32
|
+
* @source https://wiki.facepunch.com/gmod/Task:InitFunctionName
|
|
33
|
+
*/
|
|
34
|
+
InitFunctionName(self: Task, startname: string, runname: string, taskdata: number): void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface Task {
|
|
38
|
+
/**
|
|
39
|
+
* Determines if the task is an engine task (`TYPE_ENGINE`, 1).
|
|
40
|
+
* @realm server
|
|
41
|
+
* @source https://wiki.facepunch.com/gmod/Task:IsEngineType
|
|
42
|
+
*/
|
|
43
|
+
IsEngineType(self: Task): void;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface Task {
|
|
47
|
+
/**
|
|
48
|
+
* Determines if the task is an NPC method-based task (`TYPE_FNAME`, 2).
|
|
49
|
+
* @realm server
|
|
50
|
+
* @source https://wiki.facepunch.com/gmod/Task:IsFNameType
|
|
51
|
+
*/
|
|
52
|
+
IsFNameType(self: Task): void;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
interface Task {
|
|
56
|
+
/**
|
|
57
|
+
* Runs the AI task.
|
|
58
|
+
* @realm server
|
|
59
|
+
* @source https://wiki.facepunch.com/gmod/Task:Run
|
|
60
|
+
*/
|
|
61
|
+
Run(self: Task, target: NPC): void;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
interface Task {
|
|
65
|
+
/**
|
|
66
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
67
|
+
* Runs the AI task as an NPC method. This requires the task to be of type `TYPE_FNAME`.
|
|
68
|
+
* @realm server
|
|
69
|
+
* @source https://wiki.facepunch.com/gmod/Task:Run_FName
|
|
70
|
+
*/
|
|
71
|
+
Run_FName(self: Task, target: NPC): void;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface Task {
|
|
75
|
+
/**
|
|
76
|
+
* Starts the AI task.
|
|
77
|
+
* @realm server
|
|
78
|
+
* @source https://wiki.facepunch.com/gmod/Task:Start
|
|
79
|
+
*/
|
|
80
|
+
Start(self: Task, target: NPC): void;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
interface Task {
|
|
84
|
+
/**
|
|
85
|
+
* **INTERNAL**: This is used internally - although you're able to use it you probably shouldn't.
|
|
86
|
+
* Starts the AI task as an NPC method.
|
|
87
|
+
* @realm server
|
|
88
|
+
* @source https://wiki.facepunch.com/gmod/Task:Start_FName
|
|
89
|
+
*/
|
|
90
|
+
Start_FName(self: Task, target: NPC): void;
|
|
91
|
+
}
|
|
92
|
+
|