-
Notifications
You must be signed in to change notification settings - Fork 334
Expression 2 Table
Tables and Arrays are used to store variables into an ordered, accessible type of variable. They make up a special case of variable access and assignment.
Arrays are functionally similar to tables, in particular being slightly more efficient, but they cannot store arrays or tables themselves, and do not have string key indices.
Syntax | Description |
---|---|
TableVar["test",bone] | This will return the value at the table's "test" string key, with the explicit type "bone" |
TableVar[4,bone] | This will return the value at the table's 4th numeric index, with the explicit type "bone" |
TableVar[8,vector] = Vec | This assigns the variable Vec to TableVar's 8th index. |
VarArray["beef",vector] = Vec | This assignment is invalid, as arrays do not have string keys. |
Below is a function list from the Table core and Array core extensions. Any functions that are supported only by either an array or a table are listed further down below.
Function | Return | Example | |
---|---|---|---|
T:concat([S,N,N]) | T=table(2,3), T["a",number]=4, print(T:concat()) | 23 | |
Concatenates the elements of the table/array's numeric indices to a string in order. Optionally, a string delimiter may be used, which separates the concatenated elements in the returned string. You may also define the index to start at, and an index to end at, inclusively. Starts at index 1 by default. Nonexistent consecutive elements will concatenate to the string "nil". | |||
T:concat() A:concat() |
T=table(2,3), T["a",number]=4, print(T:concat()) | 23 | |
Concatenates the elements of the table/array's numeric indices to a string. |
A common optimization trick using Tables involves the use of T:exists() to check if a table contains a string key . This avoids having to do long elseif chains to find one particular string in a set of referenced strings.
For example, say you have an E2 door that only allows people on your friends list. How do know who to let through the door?
We'll add yourself in to start.
Table = table() Table["STEAM_0:0:0",number] = 1The element in this case doesn't really matter, since we only need the string key. Now if you want to add anyone to your friends list, you can add their Steam ID as a key to the table just as easily,
Table[Player:steamID(),number] = 1and reference them later more efficiently.
local ID = Target:steamID() if(Table:exists(ID)){ Door:open() }You can even do neat tricks like returning different values for different keys. Just in case you wanted to have a list of people your doorside turret will automatically set to kill.
if(!Table[ID,number]){ if(TargetModeNeutral & Table:exists(ID)){ #Check if we have the target on the blacklist (0 return on steamID) Turret:shootAt(Target:pos()) }elseif(!TargetModeNeutral){ #We're not neutral, target everyone that isn't our friend. Turret:shootAt(Target:pos()) } #else do nothing }
Please do not alter the e2 docs ...
pages manually.
They are autogenerated from the E2Helper. In the future, this will hopefully be its own dedicated website or tool.
Basic Features: core, debug, number, selfaware,
string, timer
🌎 World: angle, color, find, ranger, sound,
🔣 Math: bitwise, complex, matrix, quaternion, vector, vector2/4
📦 Entities: bone, constraint, egp, entity, hologram, npc
👨 Players: chat, console, player, weapon
📊 Data storage: array, files, globalvars, serialization, table
💬 Communication: datasignal, http, signal, wirelink,
❓ Informational: gametick, serverinfo, steamidconv, unitconv
Disabled by default: constraintcore, effects, propcore, remoteupload, wiring
Wire-Extras (repo): camera, ftrace, holoanim, light, stcontrol, tracesystem
- Home 🏠
- Syntax 🔣
- Directives 🎛️
- Editor 🖥️
- Events 🌟 (new!)
Click To Expand
- 🟥 SPU
- 🟥 Address Bus
- 🟥 Extended Bus
- 🟥 Plug/Socket
- 🟥 Port
- 🟥 Transfer Bus
- 🟩 GPU
- 🟥 Dynamic Memory
- 🟥 Flash EEPROM
- 🟥 ROM
- 🟧 Beacon Sensor
- 🟧 Locator
- 🟧 Target Finder
- 🟧 Waypoint
- 🟥 XYZ Beacon
- 🟩 CPU
- 🟩 Expression 2
- 🟩 Gates
- 🟥 PID
- 🟧 CD Disk
- 🟥 CD Ray
- 🟧 DHDD
- 🟥 Keycard
- 🟥 RAM-card
- 🟧 Satellite Dish
- 🟧 Store
- 🟧 Transferer
- 🟥 Wired Wirer
- 🟧 Adv Entity Marker
- 🟧 Damage Detector
- 🟧 Entity Marker
- 🟧 GPS
- 🟧 Gyroscope
- 🟥 HighSpeed Ranger
- 🟧 Laser Pointer Receiver
- 🟥 Microphone
- 🟧 Ranger
- 🟧 Speedometer
- 🟧 Water Sensor
- 🟧 7 Segment Display
- 🟥 Adv. Hud Indicator
- 🟧 Console Screen
- 🟧 Control Panel
- 🟧 Digital Screen
- 🟧 EGP v3
- 🟧 Fix RenderTargets
- 🟥 GPULib Switcher
- 🟧 Hud Indicator
- 🟧 Indicator
- 🟧 Lamp
- 🟧 Light
- 🟧 Oscilloscope
- 🟧 Pixel
- 🟧 Screen
- 🟧 Sound Emitter
- 🟧 Text Screen
- 🟩 Cam Controller
- 🟧 Colorer
- 🟧 FX Emitter
- 🟧 HighSpeed Holoemitter
- 🟧 HoloEmitter
- 🟧 HoloGrid
- 🟥 Interactable Holography Emitter
- 🟥 Materializer
- 🟥 Painter
- 🟧 Adv. Input
- 🟧 Button
- 🟧 Constant Value
- 🟥 Door Controller
- 🟧 Dual Input
- 🟧 Dynamic Button
- 🟧 Eye Pod
- 🟧 Graphics Tablet
- 🟧 Keyboard
- 🟥 Lever
- 🟧 Numpad
- 🟧 Numpad Input
- 🟧 Numpad Output
- 🟧 Plug
- 🟧 Pod Controller
- 🟧 Radio
- 🟧 Relay
- 🟧 Text Receiver
- 🟧 Two-way Radio
- 🟧 Vehicle Controller
- 🟥 Door
- 🟥 Adv. Dupe. Teleporter
- 🟥 Buoyancy
- 🟧 Clutch
- 🟧 Detonator
- 🟧 Explosives
- 🟧 Explosives (Simple)
- 🟥 Forcer
- 🟩 Freezer
- 🟧 Gimbal (Facer)
- 🟧 Grabber
- 🟧 Hoverball
- 🟧 Hoverdrive Controller
- 🟥 Hydraulic
- 🟧 Igniter
- 🟧 Nailer
- 🟩 Prop Spawner
- 🟥 Servo
- 🟥 Simple Servo
- 🟧 Thruster
- 🟥 Touchplate
- 🟥 Trail
- 🟩 Turret
- 🟩 User
- 🟥 Vector Thruster
- 🟥 Vehicle Exit Point
- 🟧 Weight (Adjustable)
- 🟧 Weld/Constraint Latch
- 🟥 Wheel
- 🟥 Wire Magnet
- 🟥 Wired Npc Controller
- 🟧 Debugger
- 🟥 GUI Wiring
- 🟥 Multi Wire
- 🟧 Namer
- 🟥 Simulate Data
- 🟩 Wiring
- 🟥 Beam Reader
- 🟥 Implanter
- 🟥 Reader
- 🟥 Target Filter
- 🟥 User Reader
Gates 🚥
Click To Expand
TBD