Skip to content

Components

Rusketh edited this page May 7, 2014 · 17 revisions

Table of Contents

Components

Components add functionality to lemongate, they provide both functions and classes.

Booleans

The boolean class also supports the alias bool.

Operator Return Description
(string) Boolean String Casts a boolean to a string of either "true" or "false".
(number) Boolean Number Casts a boolean to a number ( 1 for true and 0 for false).

Self Aware/Server

Function Return Description
self() Entity Returns the entity of the executing lemongate.
gateName() String Returns the name of the executing lemongate.
gateName(String) Void Sets the name of the executing lemongate.
cpuTime() Number Returns the amount of cpu time used so far in the current execution in microseconds.
cpuTime() Number Returns the amount of cpu time used so far in the current execution in microseconds.
cpuAverage() Number Returns the amount of cpu time used on average in microseconds.
tickQuota() Number Returns the size of the tick quota in microseconds.
softQuota() Number Returns the size of the soft quota in microseconds.
hardQuota() Number Returns the size of the hard quota in microseconds.
owner() Entity Returns the owner of the executing lemongate.
isDedicated() Boolean Returns true if game is o
isSinglePlayer() Boolean Returns true if game is in single player.
curTime() Number Returns the time since server start in seconds.
airDensity() Number Returns the air density of the server.
angSpeedLimit() Number Returns the angular speed limit of the server.
gravity() Number Returns the gravity setting of the server.
propGravity() Vector Returns the gravity of the server as a vector.
hostName() String Returns the host name of the server.
getPlayers() Entity[] Returns an array of every player on the server.
maxPlayers() Number Returns the player limit of the current server.
sysTime() Number Returns the current system time of the server.
exit() Void Exits the currently executing thread.
selfDestruct() Void Removes the LemonGate.
include(Raw String, Raw Boolean) Void Includes the file, and will use current scope as root scope for include if boolean is false.

Math Component

The number class also supports the alias int.

Operator Return Description
(string) Number String Casts a number to a string.
Function Return Description
pi() Number Returns pi (approximately 3.1415926535898).
abs(Number) Number Returns the absolute value of a number.
abs(Quaternion) Number Returns the magnitude (length) of a quaternion.
acos(Number) Number Returns the inverse cosine of (number degrees).
acosr(Number) Number Returns the inverse cosine of (number radians).
asin(Number) Number Returns the inverse sine of (number degrees).
asinr(Number) Number Returns the inverse sine (number radians).
atan(Number, Number) Number Returns the inverse tangent of (number degrees).
atan(Number) Number Returns the inverse tangent of (number degrees).
atanr(Number, Number) Number Returns the inverse tangent (number radians).
atanr(Number) Number Returns the inverse tangent (number radians).
cbrt(Number) Number Returns the cube root of (number).
ceil(Number, Number) Number Rounds (number 1) up to (number 2)'s decimal precision.
ceil(Number) Number Rounds (number) up to nearest integer.
cos(Number) Number Returns the cosine of (number degrees).
cosh(Number) Number Returns the hyperbolic cosine of (number degrees).
coshr(Number) Number Returns the hyperbolic cosine of (number radians).
cosr(Number) Number Returns the cosine of (number radians).
cot(Number) Number Returns the cotangent of (number degrees).
coth(Number) Number Returns the hyperbolic cotangent of (number degrees).
cothr(Number) Number Returns the hyperbolic cotangent of (number radians).
cotr(Number) Number Returns the cotangent of (number radians).
csc(Number) Number Returns the cosecant of (number degrees).
csch(Number) Number Returns the hyperbolic cosecant of (number degrees).
cschr(Number) Number Returns the hyperbolic cosecant of (number radians).
cscr(Number) Number Returns the cosecant of (number radians).
clamp(Number, Number, Number) Number Clamps (number value) between (number min) and (number max).
exp(Number) Number Returns the constant e (2.71828) to the power of (number).
floor(Number) Number Rounds (number) down to nearest integer.
inrange(Number, Number, Number) Number Returns true if (number value) is between (number min) and (number max).
int(Number) Number Returns the number to the left of the decimal (integer component).
ln(Number) Number Returns the logarithm of (number) to base e.
log(Number, Number) Number Returns the logarithm of (number1 value) to (number2 base).
log10(Number) Number Returns the logarithm of (number) to base 10.
log2(Number) Number Returns the logarithm of (number) to base 2.
max(Number, Number[,]) Number Returns the number with the highest value.
min(Number, Number[,]) Number Returns the number with the lowest value.
random() Number Returns a random floating point number between 0 and 1.
random(Number, Number) Number Returns a random floating-point number between the specified interval.
random(Number) Number Returns a random floating point number between 0 and (number max).
round(Number, Number) Number Round a number to (number)'s decimal precision.
round(Number) Number Round a number to the nearest integer.
sec(Number) Number Returns the secant of (number degrees).
sech(Number) Number Returns the hyperbolic secant of (number degrees).
sechr(Number) Number Returns the secant of (number radians.
secr(Number) Number Returns the hyperbolic secant of (number radians).
sign(Number) Number Returns the sign of (number).
sin(Number) Number Returns the sine of (number degrees).
sinh(Number) Number Returns the hyperbolic sine of (number degrees).
sinhr(Number) Number Returns the hyperbolic sine of (number radians).
sinr(Number) Number Returns the sine of (number radians).
sqrt(Number) Number Returns the square root of (number).
tan(Number) Number Returns the tangent of (number degrees).
tanh(Number) Number Returns the hyperbolic tangent of (number degrees).
tanhr(Number) Number Returns the tangent of (number radians).
tanr(Number) Number Returns the hyperbolic tangent of (number radians).
toDeg(Number) Number Converts (number radians) to degrees.
toRad(Number) Number Converts (number degrees) to radians.
root(Number, Number) Number Returns the root of (number base) and (number power).
frac(Number) Number Returns the number to the right of the decimal (fractional component).
elevation(Vector, Angle, Vector) Number Return the elevation between a vector facing an angle and a target vector.
bearing(Vector, Angle, Vector) Number Return the bearing between a vector facing an angle and a target vector.

String Component

Operator Return Description
(number) String Number Casts a string to a number.
#String Number Returns the length of a string.
String[Number] String Returns Nth letter of string.
Function Return Description
String:findPattern(String, Number) Number Returns the 1st occurrence of the string S starting at N and going to the end of the string using REGEX functions, returns 0 if not found.
String:findPattern(String) Number Returns the 1st occurrence of the string S using REGEX functions, returns 0 if not found.
String:format(...) String Formats a string (same as string.format in lua).
String:left(Number) String Returns the next N characters starting with the leftmost character.
String:length() Number Returns the length of a string
String:lower() String Returns a lower-cased (string).
String:matchFirst(String, Number) String Returns a string match to (string) starting at the leftmost character starting at location (number).
String:matchFirst(String) String Returns a string match to (string) starting at the leftmost character.
String:matchPattern(String, Number) String[] Matches a string and returns an array of the sub-captures starting at (number).
String:matchPattern(String) String[] Matches a string and returns an array of the sub-captures.
String:repeat(Number) String Returns a string of (string) repeated (number) times.
String:replace(String, String) String Finds and replaces every occurrence of the first argument with the second argument.
String:replacePattern(String, String) String Finds and replaces every occurrence of the first argument using REGEX with the second argument.
String:right(Number) String Returns (number) amount of characters starting with the rightmost character.
String:sub(Number, Number) String Returns a substring starting at location (number1 start) and ending at (number2 end).
String:sub(Number) String Returns a substring starting at location (number)
String:trim() String Remove spaces from the beginning and end of a string.
String:trim(String) String
String:trimLeft(String) String
String:trimRight(String) String
String:upper() String Returns an uppercased string.
String:explode(String) String[] Explodes a string into an array, each entry separated by (string).
String:find(String, Number) Number Returns he location of first instance of (string) in a string, starting at location (number).
String:find(String) Number Returns the location of first instance of (string) in a string.
String:index(Number) String Returns the Nth character of a string as a string.
toByte(String) Number Returns the ASCII code of first character in a string.
toChar(Number) String Returns a one-character string from its ASCII code, where 32 = argument 1 = 255. An empty string is returned for numbers outside that range.
print(...) Void Prints the contents of ( ... ) to chat separated with a space.

Vector Component

Operator Return Description
(string) Vector String Casts a vector to a human readable string.
(angle) Vector Angle Casts a vector to an angle.
#Vector Number Returns the lengh of a vector.
Function Return Description
vec() Vector Creates a 3 dimensional vector.
vec(Number, Number, Number) Vector Creates a 3 dimensional vector.
vec(Number) Vector Creates a 3 dimensional vector.
vec(Quaternion) Vector Creates a vector from a quaternion.
Vector:length() Number Returns the length of a vector.
Vector:length2() Number Returns the squared length of a vector.
Vector:normalized() Vector Returns a normalized vector.
Vector:rotate(Angle) Vector Rotate a vector by an angle).
round(Vector, Number) Vector Round vector XYZ components to (number)'s decimal precision.
round(Vector) Vector Round vector XYZ components to nearest integer.
Vector:abs() Vector Returns the absolute value of a vector.
Vector:setX(Number) Vector Sets the X of a vector.
Vector:setY(Number) Vector Sets the Y of a vector.
Vector:setZ(Number) Vector Sets the Z of a vector
shiftL(Vector) Vector Shift vector XYZ components to the left.
Vector:toAngle() Angle Convert a vector to an angle.
Vector:toAngle(Vector) Angle Convert 2 vectors to an angle.
Vector:x() Number Returns the X component of a vector.
Vector:y() Number Returns the Y component of a vector.
Vector:z() Number Returns the Z component of a vector.
Vector:cross(Vector) Vector Return the cross product (a vector perpendicular to both vectors).
Vector:distance(Vector) Number Return the distance between two vectors.
Vector:distance2(Vector) Number Returns the squared distance between two vectors.
Vector:dot(Vector) Number Returns the dot product (the sum of the product of the corresponding vector components).
shiftR(Vector) Vector Shift vector XYZ components to the right.
toLocalPos(Vector, Angle, Vector, Angle) Vector Converts a local vector to a world vector.
toWorldPos(Vector, Angle, Vector, Angle) Vector Converts a local vector to a world vector.
ceil(Vector, Number) Vector Rounds the components of (vector XYZ) up to (number)'s decimal precision.
ceil(Vector) Vector Rounds the components of (vector XYZ) up to nearest integer.
clamp(Vector, Vector, Vector) Vector Clamps (vector value) between (vector min) and (vector max).
inrange(Vector, Vector, Vector) Boolean Returns true if (vector value) is between (vector min) and (vector max).
mix(Vector, Vector, Number) Vector Returns a linear interpolation between two vectors.
floor(Vector) Vector Rounds components of (vector XYZ) down to nearest integer.

Vector2 Component

Operator Return Description
(string) Vector2 String Casts a vector2 to a human readable string.
#Vector2 Number Returns the lengh of a vector2.
Function Return Description
clamp(Vector2, Vector2, Vector2) Vector2 Clamps (vector2 value) between (vector2 min) and (vector2 max).
Vector2:cross(Vector) Vector2 Return the cross product (a vector perpendicular to both vectors).
Vector2:distance(Vector) Number Return the distance between two vectors.
Vector2:dot(Vector) Number Returns the dot product (the sum of the product of the corresponding vector components).
inrange(Vector2, Vector2, Vector2) Boolean Returns true if (vector2 value) is between (vector2 min) and (vector2 max).
Vector2:length() Number Returns the length of a vector.
mix(Vector2, Vector2, Number) Vector2 Returns a linear interpolation between two vectors.
Vector2:normalized() Vector2 Returns a normalized vector.
Vector2:setX(Number) Vector2 Sets the X of a vector.
Vector2:setY(Number) Vector2 Sets the Y of a vector.
Vector2:x() Number Returns the X component of a vector.
Vector2:y() Number Returns the Y component of a vector.
vec2(Number, Number) Vector2 Creates a 2 dimensional vector.

Angle Component

Operator Return Description
(string) Angle String Casts an angle to a human readable string.
(vector) Angle Angle Casts an angle to a vector.
Function Return Description
ang() Angle Creates an angle.
ang(Number, Number, Number) Angle Creates an angle PYR.
ang(Number) Angle Creates an angle.
angnorm(Angle) Angle Wraps the components of an angle between -180 and 180.
ceil(Angle, Number) Angle Rounds the components of (angle PYR) up to (number)'s decimal precision.
ceil(Angle) Angle Rounds the components of (angle PYR) up to the nearest integer.
clamp(Angle, Angle, Angle) Angle Clamps (angle value) between (angle min) and (angle max).
floor(Angle) Angle Rounds components of (angle PYR) down to nearest integer.
Angle:forward() Vector Returns the forward vector of an angle.
Angle:right() Vector Returns the right vector of an angle.
Angle:up() Vector Returns the up vector of an angle.
inrange(Angle, Angle, Angle) Boolean Returns true if (angle value) is between (angle min) and (angle max).
mix(Angle, Angle, Number) Angle Returns a linear interpolation between two angles.
Angle:p() Number Returns the pitch component of an angle (depricated use getPitch).
Angle:r() Number Returns the roll component of an angle (depricated use getRoll).
Angle:y() Number Returns the yaw component of an angle (depricated use getYaw).
Angle:getPitch() Number Returns the pitch component of an angle.
Angle:getYaw() Number Returns the yaw component of an angle.
Angle:getRoll() Number Returns the roll component of an angle.
Angle:setPitch(Number) Angle Sets the pitch component of an angle.
Angle:setYaw(Number) Angle Sets the yaw component of an angle.
Angle:setRoll(Number) Angle Sets the roll component of an angle.
Angle:changePitch(Number) Void Changes the pitch on the angle with out returning a new angle.
Angle:changeRoll(Number) Void Changes the roll on the angle with out returning a new angle.
Angle:changeYaw(Number) Void Changes the yaw on the angle with out returning a new angle.
Angle:rotateAroundAxis(Vector, Number) Angle Rotates an angle around (vector axis) by (number degrees).
round(Angle, Number) Angle Round angle PYR components to (number)'s decimal precision.
round(Angle) Angle Rounds angle PYR components to the nearest integer.
shiftL(Angle) Angle Shift angle PYR components to the left.
shiftR(Angle) Angle Shift angle PYR components to the right.
toLocalAng(Vector, Angle, Vector, Angle) Angle Converts a local angle to a world angle.
toWorldAng(Vector, Angle, Vector, Angle) Angle Converts a local angle to a world angle.

Color Component

Operator Return Description
Function Return Description
color(Number, Number, Number, Number) Color Creates a color RGBA.
color(Number, Number, Number) Color Creates a color RGB.
Color:alpha() Number Returns the alpha value of a color.
Color:red() Number Returns the red value of a color.
Color:green() Number Returns the green value of a color.
Color:blue() Number Returns the blue value of a color.
Color:setAlpha(Number) Color Sets the alpha value of a color.
Color:setRed(Number) Color Sets the red value of a color.
Color:setGreen(Number) Color Sets the green value of a color.
Color:setBlue(Number) Color Sets the blue value of a color.
Color:hsv2rgb() Color Converts a color from HSV to RGB space.
hsv2rgb(Number, Number, Number) Color Converts a color from HSV to RGB space.
Color:rgb2digi() Number
Color:rgb2hsv() Color Converts a color from RGB to HSV space.
rgb2digi(Number, Number, Number) Number
rgb2hsv(Number, Number, Number) Color Converts a color from RGB to HSV space.
Color:toString() String Converts a color to a string.

Quaternion Component

Operator Return Description
Function Return Description
quat() Quaternion Returns an empty quaternion.
quat(Angle) Quaternion Converts (angle) to a quaternion.
quat(Entity) Quaternion Converts the angles of (entity) to a quaternion.
quat(Number, Number, Number, Number) Quaternion Creates a quaternion nR nI nJ nK.
quat(Number) Quaternion Creates a quaternion with an R component of (number).
quat(Vector, Vector) Quaternion Creates a quaternion using (vector forward) and (vector up).
quat(Vector) Quaternion Converts (vector) to a quaternion.
abs(Quaternion) Number Returns the magnitude (length) of a quaternion.
conj(Quaternion) Quaternion Returns the conjugate of a quaternion.
exp(Quaternion) Quaternion
inv(Quaternion) Quaternion Returns the inverse of a quaternion.
log(Quaternion) Quaternion Returns the logarithm of a quaternion to base e.
Quaternion:forward() Vector Returns the forward vector of a quaternion.
Quaternion:right() Vector Returns the right vector of a quaternion.
Quaternion:up() Vector Returns the up vector of a quaternion.
Quaternion:i() Number Returns the I component of the quaternion.
Quaternion:j() Number Returns the J component of a quaternion.
Quaternion:k() Number Returns the K component of a quaternion.
Quaternion:real() Number Returns the R component of a quaternion.
qMod(Quaternion) Quaternion Returns the modulus of a quaternion.
qRotation(Vector, Number) Quaternion Returns a quaternion from a vector, number controls the angle.
qRotation(Vector) Quaternion Returns a quaternion from a vector, vector components control axis and angle.
qi() Quaternion Returns a quaternion with an I component of 1.
qi(Number) Quaternion Returns a quaternion with an I component of (number).
qj() Quaternion Returns a quaternion with an J component of 1.
qj(Number) Quaternion Returns a quaternion with an J component of (number).
qk() Quaternion Returns a quaternion with an K component of 1.
qk(Number) Quaternion Returns a quaternion with an K component of (number).
rotationAngle(Quaternion) Number
rotationAxis(Quaternion) Vector
rotationVector(Quaternion) Vector Returns the rotation vector of a quaternion.
slerp(Quaternion, Quaternion, Number) Quaternion Interpolates between two quaternions by a ratio of the given number.
Quaternion:toAngle() Angle Converts a quaternion to an angle.
vec(Quaternion) Vector Creates a vector from a quaternion.

Entity Component

Operator Return Description
Function Return Description
Entity:aabbMax() Vector Return the axis-aligned maximum bounding box of an entity.
Entity:aabbMin() Vector Return the axis-aligned minimum bounding box of an entity.
Entity:aimEntity() Entity Returns the aim entity of an entity (entity must be a player).
Entity:aimNormal() Vector Returns the aim hit normal of an entity (entity must be a player).
Entity:aimPos() Vector Returns the aim position of an entity (entity must be a player).
Entity:ang() Angle Returns the angles PYR of an entity.
Entity:angVel() Angle Returns the angular velocity of an entity.
Entity:angVelVector() Vector Returns the angular velocity in vector form of an entity.
Entity:applyAngForce(Angle) Void Applies an angular force to an entity.
Entity:applyForce(Vector) Void Applies a vector force to entity.
Entity:applyOffsetForce(Vector, Vector) Void Applies an offset vector force to an entity.
Entity:applyTorque(Vector) Void Applies a vector torque force to an entity.
Entity:armor() Number Returns the armor of an entity (entity must be a player).
Entity:attachmentAng(Number) Angle Returns the attachment angle N of E.
Entity:attachmentAng(String) Vector Returns the attachment angle S of E.
Entity:attachmentPos(Number) Vector Returns the attachment vector N of E.
Entity:attachmentPos(String) Vector Returns the attachment vector S of E.
Entity:bearing(Vector) Number Returns the bearing between an entity and a target vector.
Entity:boxCenter() Vector Returns the center position of an entity's bounding box.
Entity:boxMax() Vector Returns the highest corner of an entity's bounding box.
Entity:boxMin() Vector Returns the lowest corner of an entity's bounding box.
Entity:boxSize() Vector Returns the size of an entity's bounding box.
Entity:class() String Returns the class of an entity.
Entity:driver() Entity Returns the driver of an entity (must be a vehicle).
Entity:elevation(Vector) Number Returns the elevation between an entity and a target vector.
entity(Number) Entity Returns the entity associated with (number id).
Entity:eye() Vector Returns the direction entity's eyes are facing (entity must be a player).
Entity:eyeAngles() Angle Returns the angles of an entity's eyes (entity must be a player).
Entity:eyeTrace() Trace Returns a trace table using the entity's eye direction (entity must be a player).
Entity:flashLight() Boolean Returns true if the player has their flashlight toggled.
Entity:forward() Vector Returns the forward vector of an entity.
Entity:getColor() Color Returns the color RGBA of an entity.
Entity:getConstraints() Entity[] Returns an array of an entity's constraints.
Entity:getEquipped() Entity Returns the entity of the currently equipped weapon of the player.
Entity:getMaterial() String Returns the material of an entity.
Entity:getParent() Entity Returns the parent entity of an entity.
Entity:getSkin() Number Returns the current skin number of an entity.
Entity:getSkinCount() Number Returns the amount of skins an entity has.
Entity:hasConstraints() Number Returns the number of constraints entity has.
Entity:heading(Vector) Angle Returns the heading between an entity and a target vector.
Entity:health() Number Returns the current health of an entity.
Entity:id() Number Returns the entity index of E.
Entity:inNoclip() Boolean Returns true if the entity is no-clipped.
Entity:inertia() Vector Returns the inertia of an entity as a vector.
Entity:inertiaA() Angle Returns the inertia of an entity as an angle.
Entity:isAdmin() Boolean Returns true if the entity is an admin (entity must be a player).
Entity:isConstrained() Boolean Returns true if entity has any constraints.
Entity:isFrozen() Boolean Returns true if the entity is frozen.
Entity:isNPC() Boolean Returns true if entity is an NPC.
Entity:isOnFire() Boolean Returns true if entity is on fire.
Entity:isOnGround() Boolean Returns true if entity is on the ground (entity must be a player).
Entity:isPlayer() Boolean Returns true if entity is a player.
Entity:isPlayerHolding() Boolean Returns true if entity is being held by a player.
Entity:isSuperAdmin() Boolean Returns true if entity is a super admin (entity must be a player).
Entity:isUnderWater() Boolean Returns true if entity is under water.
Entity:isValid() Boolean Returns true if entity is a valid entity.
Entity:isVehicle() Boolean Returns true if entity is a vehicle.
Entity:isWeapon() Boolean Returns true if entity is a weapon.
Entity:isWeldedTo() Entity Returns the entity (entity) is welded to.
Entity:isWorld() Boolean Returns true if entity is the world.
Entity:keyBack() Boolean Returns true if player E is pressing IN_BACK.
Entity:keyDuck() Boolean Returns true if player E is pressing IN_DUCK.
Entity:keyForward() Boolean Returns true if player E is pressing IN_FORWARD.
Entity:keyJump() Boolean Returns true if player E is pressing IN_JUMP.
Entity:keyLeft() Boolean Returns true if player E is pressing IN_MOVELEFT.
Entity:keyLeftTurn() Boolean Returns true if player E is pressing IN_LEFT.
Entity:keyRight() Boolean Returns true if player E is pressing IN_MOVERIGHT.
Entity:keyRightTurn() Boolean Returns true if player E is pressing IN_RIGHT.
Entity:keySprint() Boolean Returns true if player E is pressing IN_SPEED.
Entity:keyUse() Boolean Returns true if player E is pressing IN_USE.
Entity:keyWalk() Boolean Returns true if player E is pressing IN_WALK.
Entity:keyZoom() Boolean Returns true if player E is pressing IN_ZOOM.
Entity:leftClick() Boolean Returns true if entity clicked the left mouse button (entity must be a player).
Entity:rightClick() Boolean Returns true if entity clicked the right mouse button (entity must be a player).
Entity:lookupAttachment(String) Number
Entity:mass() Number Returns the mass of an entity.
Entity:massCenter() Vector Returns the mass center of an entity as a local vector.
Entity:massCenterWorld() Vector Returns the mass center of an entity as a world vector.
Entity:model() String Returns the model path of an entity.
Entity:name() String Returns the name of an entity.
Entity:owner() Entity Returns the owner of an entity.
Entity:passenger() Entity Returns the passenger of an entity (entity must be a vehicle).
Entity:ping() Number Returns the ping of an entity (entity must be a player).
Entity:playerID() Number Returns a players ID.
Entity:pos() Vector Returns the global position of an entity.
Entity:radius() Number Returns the radius of an entity.
Entity:removeTrail() Void Removes the trail of the entity.
Entity:requestKeys(Boolean) Boolean Request key events for players E, requires 'lemon_share_keys 1'.
Entity:right() Vector Returns the right vector of an entity.
Entity:up() Vector Returns the up vector of an entity.
Entity:setColor(Color) Void Sets the color of an entity.
Entity:setMass(Number) Void Sets the mass of an entity.
Entity:setMaterial(String) Void Sets the material of an entity.
Entity:setSkin(Number) Void Sets the skin of an entity.
Entity:shootPos() Vector Returns the shoot position of an entity (entity must be a player).
Entity:steamID() String Returns the steamID of an entity (entity must be a player).
Entity:timeConnected() Number Returns the time (in seconds) that has passed since entity connected to the server (entity must be a player).
Entity:toLocal(Angle) Angle Converts an angle to a local angle.
Entity:toLocal(Vector) Vector Converts a vector to a local vector.
Entity:toWorld(Angle) Angle Converts an angle to a world angle.
Entity:toWorld(Vector) Vector Converts a vector to a world vector.
Entity:toLocalAxis(Vector) Vector Converts a world axis to an axis local to the entity.
Entity:toWorldAxis(Vector) Vector Converts a local axis to a world axis.
Entity:vehicle() Entity Returns the vehicle entity is riding in (entity must be a player).
Entity:vel() Vector Returns the velocity of an entity.
Entity:velL() Vector Returns the local velocity of an entity.
voidEntity() Entity Returns a null entity.
Entity:volume() Number Returns the volume of the entity.
Entity:setTrail(Number, Number, Number, String, Color) Void
Entity:setTrail(Number, Number, Number, String, Color, Number, Boolean) Void
world() Entity Returns the world entity.
playerByName(String, Boolean) Entity Finds a player by part name, will use an exact match when B is true.

Entity Discovery

Function Return Description
findByClass(String, Vector) Entity[] Find entities with class type (string) and returns them in an array sorted by distance to V.
findByClass(String) Entity[] Find entities with class type (string) and returns them in an array.
findByModel(String, String) Entity[] Find entities with model (string) with a class filter and returns them in an array.
findByModel(String) Entity[] Find entities with model (string) and returns them in an array.
findInBox(String, Vector, Vector) Entity[] Find entities within box (vector min, vector max) with a class filter and returns them in a table.
findInBox(Vector, Vector) Entity[] Find entities within box (vector min, vector max) and returns them in an array.
findInCone(String, Vector, Vector, Number, Angle) Entity[] Find entities in cone starting from (vector pos) in direction (vector dir) with length (number len) and width (number deg) and returns them in an array.
findInCone(Vector, Vector, Number, Angle) Entity[] Find entities of (string class) in cone starting from (vector pos) in direction (vector dir) with length (number len) and width (number deg) and returns them in an array.
findInSphere(String, Vector, Number) Entity[] Find entities of (string class) within sphere at (vector pos) with radius (number radius) and returns them in an array.
findInSphere(Vector, Number) Entity[] Find entities within sphere at (vector pos) with radius (number radius) and returns them in an array.

Physics Component

The physics object is a bone of any ragdoll (e.g Head, arms, legs, etc), every physical entity has a physics object that can be used at a lower cpu time to handle physics changes and applyforce.

Operator Return Description
(physics) Entity Physics Casts an entity to its physics object.
Function Return Description
Entity:getPhysics() Physics Returns the physics object of an entity.
Entity:getPhysicsCount() Number Returns the number of physics objects of an entity.
Entity:getPhysicsIndex(Number) Physics Returns a specific physics object, indicated by the number argument.
Physics:aabbMax() Vector Return the axis-aligned maximum bounding box of a physics object.
Physics:aabbMin() Vector Return the axis-aligned minimum bounding box of a physics object.
Physics:ang() Angle Returns the angles PYR of a physics object.
Physics:angVel() Angle Returns the angular velocity of a physics object.
Physics:angVelVector() Vector Returns the angular velocity in vector form of a physics object.
Physics:applyAngForce(Angle) Void Applies an angular force to a physics object.
Physics:applyForce(Vector) Void Applies a vector force to a physics object.
Physics:applyOffsetForce(Vector, Vector) Void Applies an offset vector force to a physics object.
Physics:applyTorque(Vector) Void Applies a vector torque force to a physics object.
Physics:bearing(Vector) Number Returns the bearing between a physics object and a target vector.
Physics:elevation(Vector) Number Returns the elevation between a physics object and a target vector.
Physics:forward() Vector Returns the forward vector of a physics object.
Physics:right() Vector Returns the right vector of a physics object.
Physics:up() Vector Returns the up vector of a physics object.
Physics:heading(Vector) Angle Returns the heading between a physics object and a target vector.
Physics:inertia() Vector Returns the inertia of a physics object as a vector
Physics:isFrozen() Boolean Returns true if the physics object is frozen.
Physics:mass() Number Returns the mass of a physics object.
Physics:massCenter() Vector Returns the mass center of a physics object.
Physics:massCenterL() Vector Returns the mass center of a physics object as a local vector.
Physics:massCenterWorld() Vector Returns the mass center of a physics object as a world vector.
Physics:pos() Vector Returns the global position of an entity.
Physics:setMass(Number) Void Sets the mass of a physics object.
Physics:toLocal(Vector) Vector Converts a vector to a local vector.
Physics:toWorld(Vector) Vector Converts a vector to a world vector
Physics:vel() Vector Returns the velocity of a physics object.

Hologram Component

Holograms are 3d projected objects. These objects can't be interacted with like most props. The hologram object extends the Entity object, but Holograms do not have physics.

Cvar Default Description
lemon_holograms_max 250 Maximum holograms per player over all LemonGates.
lemon_holograms_rate 50 Maximum holograms a player can create per second.
lemon_holograms_clips 5 Maximum visual clips per hologram.
lemon_holograms_Size 50 Maximum scale of a hologram.
lemon_holograms_model_any 1 Set to 0 to limit holograms to wiremod hologram models only.
Operator Return Description
(hologram) Entity Hologram Casts an Entity back to a hologram (will throw exception if entity is not a hologram).
(entity) Hologram Entity Casts a hologram to its entity.

Note: If a function is not listed here it is because the function is documented under the entity component.

Function Return Description
canMakeHologram() Boolean Returns true if a hologram can be created.
hologram() Hologram Creates a hologram.
hologram(Number) Hologram Returns the hologram with the id set to N.
hologram(String, Vector, Angle) Hologram Creates a hologram with (string model) at (vector position) with (angle rotation).
hologram(String, Vector) Hologram Creates a hologram with (string model) at (vector position).
hologram(String) Hologram Creates a hologram with (string model).
asGameModel(String) String Converts a hologram model into a game model.
hologramAnyModel() Number Returns 1 if holograms are allowed to use any model.
hologramClipLimit() Number Returns the current clip limit per hologram.
hologramLimit() Number Returns the current hologram limit.
hologramMaxScale() Number Returns the current maximum hologram scale.
hologramSpawnRate() Number Returns the burst rate for creating holograms.
Hologram:setPos(Vector) Void Sets the position of a hologram.
Hologram:setAng(Angle) Void Sets the angle of a hologram.
Hologram:setModel(String) Void Sets the model of a hologram.
Hologram:setID(Number) Void Sets the id of a hologram for use with hologram(N), the ID is specific to the LemonGate.
Hologram:getID() Number Returns the current ID of hologram H.
Hologram:setScale(Vector) Void Sets the scale of a hologram.
Hologram:setScaleUnits(Vector) Void Sets the scale of a hologram in units.
Hologram:getScale() Vector Returns the scale of a hologram.
Hologram:getScaleUnits() Vector Returns the scale of a hologram in units.
Hologram:getSkin() Number Returns the current skin number of hologram.
Hologram:getSkinCount() Number Returns the amount of skins a hologram has.
Hologram:setSkin(Number) Void Sets the skin of a hologram.
Hologram:animation(String) Number Gets lookup number of an animation.
Hologram:setAnimation(Number, Number, Number) Void Sets the animation of a hologram.
Hologram:setAnimation(String, Number, Number) Void Sets the animation of a hologram.
Hologram:setAnimationRate(Number) Void Sets the animation rate of a hologram.
Hologram:getAnimation() Number Returns the current animation of a hologram.
Hologram:getAnimationName() String Returns the name of the current animation of a hologram.
Hologram:animationLength() Number Gets the lengh of the animation running on H.
Hologram:setPose(String, Number) Void Sets the pose of a hologram.
Hologram:getPose(String) Number Gets the pose of a hologram.
Hologram:boneCount() Number Returns the amount of bones of a hologram.
Hologram:getBoneAng(Number) Vector Gets the angle of bone N on hologram.
Hologram:getBonePos(Number) Vector Gets the position of bone N on hologram.
Hologram:getBoneScale(Number) Vector Gets the scale of bone N on hologram.
Hologram:jiggleBone(Number, Boolean) Void Makes the bone N on the hologram jiggle about when B is true.
Hologram:setBoneAngle(Number, Angle) Void Sets the angle of bone N on the hologram.
Hologram:setBonePos(Number, Vector) Void Sets the position of bone N on the hologram.
Hologram:setBoneScale(Number, Vector) Void Sets the scale of bone N on the hologram.
Hologram:shading(Boolean) Void Enables or disables shading of a hologram.
Hologram:hasShading() Boolean Returns true if a hologram has shading enabled.
Hologram:visible(Boolean) Void Enables or disables visibility of a hologram.
Hologram:isVisible() Boolean Returns true of the hologram is visible.
Hologram:stopMove() Void Stops the moment animation of a hologram.
Hologram:moveTo(Vector, Number) Void Animates the hologram to move to V, N is speed.
Hologram:stopRotate() Void Stops the rotation animation of a hologram.
Hologram:rotateTo(Angle, Number) Void Animates a hologram to move to rotation A, N is speed.
Hologram:stopScale() Void Stops the rescale animation of a hologram.
Hologram:scaleTo(Vector, Number) Void Animates a hologram to rescale to size V, N is speed.
Hologram:scaleToUnits(Vector, Number) Void Animates a hologram to rescale to size V in units, N is speed.
Hologram:getParent() Entity Returns the parent entity of a hologram.
Hologram:getParentHolo() Hologram Returns the parent hologram of a hologram.
Hologram:unParent() Void Unparents H from its parent.
Hologram:parent(Entity) Void Sets the parent entity of a hologram.
Hologram:parent(Hologram) Void Sets the parent hologram of a hologram.
Hologram:parent(Physics) Void Sets the parent physics object of a hologram.
Hologram:enableClip(Number, Boolean) Void Enables clip (number) on the hologram if (boolean) is true.
Hologram:pushClip(Number, Vector, Vector) Void Clip a hologram, (number clip index) at (vector position) across (vector axis).
Hologram:setClipNormal(Number, Vector) Void Set the normal of clip N on hologram.
Hologram:setClipOrigin(Number, Vector) Void Set the origin of clip N on hologram.
Hologram:getMaterial() String Returns the material of a hologram.
Hologram:getColor() Color Returns the color RGBA of hologram.
Hologram:remove() Void Removes the hologram.
Hologram:setBodygroup(Number, Number) Void Sets the bodygroup of a hologram (number groupID) (number subID).
Hologram:setColor(Color) Void Sets the color of a hologram.
Hologram:setMaterial(String) Void Sets the material of a hologram.
Hologram:blockPlayer(Entity) Void Blocks a player from seeing the hologram.
Hologram:unblockPlayer(Entity) Void unblocks a player from seeing the hologram, allow them to see it again.
Hologram:isBlocked(Entity) Boolean Returns true is a player is blocked from seeing the hologram.

Client Commands

The following clientside commands have been added, to help deal with abusive hologram use.

Command Default
lemon_hologram block {player/all} Prevents the specific players holograms from being visible on the client.
lemon_hologram unblock {player/all} Allows the specific players holograms to be visible on the client.
lemon_hologram label {player/all} Displays the name of the owner on all holograms owned by the player.
lemon_hologram unlabel {player/all} Disables the above.

Team Functions

Function Return Description
Entity:team() Number Returns the team of player E.
teamColor(Number) Color Returns the color of team N.
teamDeaths(Number) Number Gets the deaths of team N.
teamFrags(Number) Number Gets the frags of team N.
teamName(Number) String Gets the name of team N.
teamScore(Number) Number Gets the score of team N.
teams() Table Returns a table of teams for this server.

Timer Component

Expression Advanced adds timers that execute functions given to them.

Function Return Description
time(String) Number Returns the current time is unit S.
timerAdjust(String, Function) Void Changes the function being used by a timer.
timerAdjust(String, Number, Number) Void Modify an existing timer with (string name), (number time), (number repetitions).
timerAutoRemove(String, Boolean) Void Sets a timer to remove itself once it has expired.
timerCreate(String, Number, Number, Function) Void Create a timer with (string name), (number time), (number repetitions), (function to execute).
timerCreate(String, Number, Number, Function, Boolean) Void Create a timer with (string name), (number time), (number repetitions), (function to execute), (boolean remove once expired).
timerCreate(String, Number, Number, Function, Boolean, ...) Void Create a timer with (string name), (number time), (number repetitions), (function to execute), (boolean remove once expired), (vararg passed to function).
timerPause(String) Number Pause a timer.
timerRemove(String) Void Remove a timer.
timerRepetitions(String) Number Gets the current repetitions of a timer.
timerStart(String) Number Start a timer.
timerStatus(String) Number Gets the status of a timer as a number.
timerStop(String) Number Stop a timer.
timerUnpause(String) Number Unpause a timer.

Communication Component

The communication component adds a buffer object, base types can be written and read to / from buffers in order. They are mainly used by events to store and send data between dupe files and gates.

Function Return Description
buffer() Buffer Creates a new buffer object.
Buffer:readAngle() Angle Reads an angle from a buffer.
Buffer:readBool() Boolean Reads a boolean of a buffer.
Buffer:readEntity() Entity Reads an entity from a buffer.
Buffer:readNumber() Number Reads a number from a buffer.
Buffer:readPos() Number Returns the current read position of the buffer.
Buffer:readString() String Reads a string from the buffer.
Buffer:readVector() Vector Reads a vector of a buffer.
Buffer:send(String, Entity) Void Sends a buffer to E (using the receiveBuffer event) using S as message name.
Buffer:skip() Void Skip the next object on buffer.
Buffer:type() String Returns the type of next object on a buffer.
Buffer:type(Number) String Returns the type of object on buffer at inded.
Buffer:writeAngle(Angle) Void Writes an angle onto a buffer.
Buffer:writeBool(Boolean) Void Writes a boolean onto a buffer.
Buffer:writeEntity(Entity) Void Writes an entity onto a buffer.
Buffer:writeNumber(Number) Void Writes a number onto a buffer.
Buffer:writePos() Number Returns the current Write position on the buffer.
Buffer:writeString(String) Void Writes a string onto a buffer.
Buffer:writeVector(Vector) Void Writes a vector onto a buffer.

Coroutine Component

A coroutine is a function capable of being yielded (paused) mid execution to be resumed later from the exact same position in code.

Function Return Description
coroutine(Function) Coroutine Creates a new coroutine using a function.
getCoroutine() Coroutine Returns the current coroutine or throws exception.
Coroutine:resume(...) Boolean Resumes / starts a coroutine, with a vararg to pass to the function.
Coroutine:resume() Boolean Resumes / starts a coroutine.
sleep(Number) Void Pauses the current coroutine for N seconds.
Coroutine:status() String Returns the status of a coroutine.
wait(String) Void Pauses the current coroutine until event S is called.
yield() Void Yields the current coroutine to be resumed later.

Sound Component

Function Return Description
Sound:duration() Number Returns the duration of a sound.
Sound:duration(Number) Void Sets the duration of a sound.
Sound:entity() Entity Returns the attachment entity of a sound.
Sound:fade(Number) Void Fades out the sound, (number) is the duration of fade.
Sound:fade(Number, Number) Void Fades out the sound after (number 1) seconds, (number 2) is the duration of fade.
Sound:isPlaying() Boolean Returns true if the sound is currently playing.
Sound:level() Number Returns the level of a sound in decibels.
Sound:level(Number) Void Sets the level of a sound in decibels.
Sound:path() String Returns the path of a sound.
Sound:pitch() Number Returns the pitch of a sound.
Sound:pitch(Number) Void Sets the pitch of a sound.
Sound:play() Void Starts playing a sound.
Sound:play(Number) Void Starts playing a sound, for (number) duration.
Sound:restart() Void Stops and then starts a sound.
sound(Entity, String, Number) Sound Creates a sound object attached to an entity, where (string) is sound path and (number) is duration.
sound(Entity, String) Sound Creates a sound object attached to an entity, where (string) is sound path.
sound(Hologram, String, Number) Sound
sound(Hologram, String) Sound
sound(String, Number) Sound Creates a sound object, where (string) is sound path and (number) is duration.
sound(String) Sound Creates a sound object, where (string) is sound path.
sounds() Table Returns at table of all the sound objects owned the gate.
Sound:stop() Void Stops a sound.
Sound:volume() Number Returns the volume of a sound.
Sound:volume(Number) Void Sets the volume of a sound.

File Component

Cvar Default Description
lemon_file_delay 5 Unknown.
lemon_file_transfer_max 5 Maximum file operations per player.
lemon_file_max_size 300 Maximum file size.
Constant Type
FILE_UNKNOWN Number
FILE_OK Number
FILE_TIMEOUT Number
FILE_404 Number
FILE_TRANSFER_ERROR Number
Function Return Description
fileAppend(String, String) Void TODO
fileAppend(String, String, Function) Void TODO
fileList(String, Function) Void TODO
fileList(String, Function, Function) Void TODO
fileLoad(String, Function) Void TODO
fileLoad(String, Function, Function) Void TODO
fileWrite(String, String) Void TODO
fileWrite(String, String, Function) Void TODO

Kinect Component

LemonGate has support for the Kinect Motion Sensor. Note A player must have the client cvar "lemon_kinect_allow" set to 1 for there sensor to be accessed, this can be changed in the settings menu of the editor.

Function Return Description
Entity:hasKinect() Boolean Returns true if player (E) has a kinect.
Entity:kinectActive() Boolean Returns true if player's (E) kinect is active.
Entity:kinectHead() Vector Gets a position from the players motion sensor.
Entity:kinectHip() Vector Gets a position from the players motion sensor.
Entity:kinectLeftAnkle() Vector Gets a position from the players motion sensor.
Entity:kinectLeftElbow() Vector Gets a position from the players motion sensor.
Entity:kinectLeftFoot() Vector Gets a position from the players motion sensor.
Entity:kinectLeftHand() Vector Gets a position from the players motion sensor.
Entity:kinectLeftHip() Vector Gets a position from the players motion sensor.
Entity:kinectLeftKnee() Vector Gets a position from the players motion sensor.
Entity:kinectLeftShoulder() Vector Gets a position from the players motion sensor.
Entity:kinectLeftWrist() Vector Gets a position from the players motion sensor.
Entity:kinectRightAnkle() Vector Gets a position from the players motion sensor.
Entity:kinectRightElbow() Vector Gets a position from the players motion sensor.
Entity:kinectRightFoot() Vector Gets a position from the players motion sensor.
Entity:kinectRightHand() Vector Gets a position from the players motion sensor.
Entity:kinectRightHip() Vector Gets a position from the players motion sensor.
Entity:kinectRightKnee() Vector Gets a position from the players motion sensor.
Entity:kinectRightShoulder() Vector Gets a position from the players motion sensor.
Entity:kinectRightWrist() Vector Gets a position from the players motion sensor.
Entity:kinectShoulder() Vector Gets a position from the players motion sensor.
Entity:kinectSpine() Vector Gets a position from the players motion sensor.
Entity:startKinect() Void Activates a players motion sensor.

Console Componenet

This component allows or the owner of a LemonGate to execute console commands on itself. Note A player must have the client cvar "lemon_console_allow" set to 1, this can be changed in the settings menu of the editor.

Function Return Description
concmd(String, String) Boolean Executes a concomand on the owner of the LemonGate.
concmd(String) Boolean Executes a concomand on the owner of the LemonGate.

HTTP Component

Function Return Description
httpPostRequest(String, Table, Function, Function) Void Makes a HTTP POST request to S with POST parameters T and calls F1 with Body[String] on success and F2 with no parameters on failure.
httpRequest(String, Function, Function) Void Makes a HTTP GET request to S and calls F1 with Body[String] on success and F2 with no parameters on failure.

WireLink Component

Operator Return Description
(wirelink) Entity Entity Casts a wirelink to an entity.
(entity) Wirelink Wirelink Casts an entity to its wirelink form, and creates a wirelink if it doesn't exist.
WireLink[Number] Number Writes a number to a highspeed device.
WireLink[String,] <type> Returns the output of String on the wirelinks entity.
WireLink[String,] = <type> Sets the input of String on the wirelinks entity.
Function Return Description
Wirelink:hasInput(String) Boolean Returns true if the linked component has an input of the specified name.
Wirelink:hasOutput(String) Boolean Returns true if the linked component has an output of the specified name.
Wirelink:inputType(String) String Returns the wiretype of an input on the linked component.
Wirelink:outputType(String) String Returns the wiretype of an output on the linked component.
Wirelink:isHiSpeed() Boolean Returns true if the wirelinked object supports the HiSpeed interface. See wiremod wiki for more information.
Wirelink:readArray(Number, Number) Table Reads a table from a high speed wirelink.
Wirelink:readCell(Number) Number Reads from high speed memory on the linked component.
Wirelink:readString(Number) String Reads a string from a high speed wirelink.
Wirelink:writeCell(Number, Number) Boolean Writes to high speed memory on the linked component.
Wirelink:writeString(Number, String) Number Writes a string to highspeed wirelink.
Wirelink:writeString(String, Number, Number) Void A helper function for using the Wired Console Screen. (Text, X, Y).
Wirelink:writeString(String, Number, Number, Color) Void A helper function for using the Wired Console Screen. (Text, X, Y, Text Col)
Wirelink:writeString(String, Number, Number, Color, Color) Void A helper function for using the Wired Console Screen. (Text, X, Y, Text Col, BG Color)
Wirelink:writeString(String, Number, Number, Color, Color, Boolean) Void A helper function for using the Wired Console Screen. (Text, X, Y, Text Col, BG Color, Flash)
Wirelink:writeString(String, Number, Number, Color, Number) Void A helper function for using the Wired Console Screen.
Wirelink:writeString(String, Number, Number, Color, Number, Boolean) Void A helper function for using the Wired Console Screen.
Wirelink:writeString(String, Number, Number, Number) Void A helper function for using the Wired Console Screen.
Wirelink:writeString(String, Number, Number, Number, Color) Void A helper function for using the Wired Console Screen.
Wirelink:writeString(String, Number, Number, Number, Color, Boolean) Void A helper function for using the Wired Console Screen.
Wirelink:writeString(String, Number, Number, Number, Number) Void A helper function for using the Wired Console Screen.
Wirelink:writeString(String, Number, Number, Number, Number, Boolean) Void A helper function for using the Wired Console Screen.
Wirelink:writeTable(Number, Table) Number Writes a table to highspeed wirelink, this includes sub tables.

Ranger Component

Function Return Description
Ranger:clear() Void Clears the ranger data of the ranger.
Ranger:clearFilter(Entity) Void Clears the entity filter of a ranger.
Ranger:defaultZero() Boolean Returns true if a trace is set to default zero.
Ranger:defaultZero(Boolean) Void Sets the default zero of a trace.
Ranger:end() Vector Returns the end position of a ranger.
Ranger:entity() Entity Returns the hit entity of a ranger.
Ranger:filter(Entity) Void Filters an entity from a ranger.
Ranger:fire() Void Generates the ranger data of the ranger.
Ranger:fire(Vector, Vector) Void Generates the ranger data of the ranger, using start and end position.
Ranger:fire(Vector, Vector, Number) Void Generates the ranger data of the ranger, using start position, direction and distance.
Ranger:fraction() Number This is a number between 0 and 1. Ex. 0.01 = 1/100 of your ranger's max range.
Ranger:fractionLeftSolid() Number If the ranger starts in a solid, this describes when the ranger leaves it as a fraction of the trace distance.
Ranger:hit() Boolean Returns true if the ranger hit anything.
Ranger:hitBox() Number Returns the ENUM of hitGroup the ranger hit. Alternative to hitGroup. See wiki for list of ENUMs.
Ranger:hitBoxbone() Number
Ranger:hitGroup() Number
Ranger:hitNoDraw() Boolean Returns true if the ranger hit a no-draw brush.
Ranger:hitNoneWorld() Boolean Returns true if the ranger hit a non-world surface (a prop, for example).
Ranger:hitNormal() Vector Returns the normal of the surface that was hit by ranger.
Ranger:hitPhysics() Number Returns the index of the physics object (on the hit entity) hit by a ranger.
Ranger:hitPos() Vector Returns the position that was hit by ranger.
Ranger:hitSky() Boolean Returns true if skybox was hit by ranger.
Ranger:hitTexture() String Returns the texture of surface hit by ranger.
Ranger:hitWater() Boolean Returns true if a ranger is allowed to hit the world.
Ranger:hitWater(Boolean) Void Sets if a ranger is allowed to hit water.
Ranger:hitWorld() Boolean Sets if a ranger is allowed to hit the world.
Ranger:ignoreEntities() Boolean Returns true if the ranger is set to ignore all entities.
Ranger:ignoreEntities(Boolean) Void Sets a ranger to ignore all entities.
Ranger:ignoreWorld() Boolean Returns true if the ranger is set to ignore world.
Ranger:ignoreWorld(Boolean) Void Sets a ranger to ignore the world.
Ranger:materialType() Number Returns the type of material hit by the ranger.
Ranger:maxs() Vector Returns the box max of a trace.
Ranger:mins() Vector Returns the box min of a trace.
Ranger:noHull() Void Removes the box min and max from the trace.
Ranger:normal() Vector Returns a normalized vector representing the direction of the ranger from start to finish.
ranger() Ranger Creates a new ranger object.
Ranger:setHull(Vector, Vector) Void Sets the mix and max hull size of a ranger.
Ranger:start() Vector Sets the start position of a ranger.
Ranger:startSolid() Boolean Units before trace exited a solid object.
Ranger:unfilter(Entity) Void Removes E from a rangers filter.

Trace Component

The trace component is now deprecated and was replaced with Ranger component, it may be modified or removed in a future update.

Function Return Description
clearFilter(Trace) Void Clears the entity filter of a trace.
Trace:endPos(Vector) Void Sets the end position of a trace.
Trace:entity() Entity Returns the hit entity of a trace.
Entity:eyeTrace() Trace Returns a trace table using the entity's eye direction (entity must be a player).
Trace:filter(Entity) Void Filters an entity from a trace.
Trace:fraction() Number This is a number between 0 and 1. Ex. 0.01 = 1/100 of your tracer's max range.
Trace:fractionLeftSolid() Number If the trace starts in a solid, this describes when the trace leaves it as a fraction of the trace distance.
Trace:getHitState() Number Returns the hitstate as a number.
Trace:hit() Boolean Returns true if trace hit anything.
Trace:hitAll() Void Trace Mask: All.
Trace:hitAuxilory(Boolean) Void Trace Mask: Auxiliary
Trace:hitBone() Number Returns the ENUM of bone hit by trace. See wiki for list of ENUMs.
Trace:hitBox() Number Returns the ENUM of hitGroup the trace hit. Alternative to hitGroup. See wiki for list of ENUMs.
Trace:hitDebris(Boolean) Void Trace Mask: Debris
Trace:hitDetail(Boolean) Void Trace Mask: Detail props
Trace:hitGrate(Boolean) Void Trace Mask: Grate
Trace:hitGroup() Number Returns the ENUM of hitGroup the trace hit. Alternative to hitBox. See wiki for list of ENUMs.
Trace:hitHitboxes(Boolean) Void Trace Mask:
Trace:hitLadders(Boolean) Void Trace Mask: Ladders
Trace:hitMaterial() Number Returns the ENUM of material hit by trace. See wiki for list of ENUMs.
Trace:hitMoveable(Boolean) Void Trace Mask:
Trace:hitNPC(Boolean) Void Trace Mask: NPC
Trace:hitNPCClip(Boolean) Void Trace Mask:
Trace:hitNoDraw() Boolean Returns true if the trace hit a no-draw brush.
Trace:hitNonWorld() Boolean Returns true if the trace hit a non-world surface (a prop, for example).
Trace:hitNormal() Vector Returns the normal of the surface that was hit by trace.
Trace:hitOpaque(Boolean) Void Trace Mask:
Trace:hitOrigin(Boolean) Void Trace Mask:
Trace:hitPlayerClip(Boolean) Void Trace Mask:
Trace:hitPortal(Boolean) Void Trace Mask:
Trace:hitPos() Vector Returns the position that was hit by trace.
Trace:hitSky() Boolean Returns true if skybox was hit by trace.
Trace:hitSlime(Boolean) Void Trace Mask: Slime
Trace:hitSolid(Boolean) Void Trace Mask: Solid
Trace:hitTexture() String Returns the texture of surface hit by trace.
Trace:hitTranslucent(Boolean) Void Trace Mask:
Trace:hitWater(Boolean) Void Trace Mask: Water
Trace:hitWindows(Boolean) Void Trace Mask:
Trace:hitWorld() Boolean Trace Mask: World.
Trace:ignoreNoDraw(Boolean) Void Trace Mask: No-Draw textures
Trace:normal() Vector Returns a normalized vector representing the direction of the trace from start to finish.
Trace:setHitState(Number) Void Sets a traces hit state.
Trace:startPos(Vector) Void Sets the start position of a trace.
Trace:startSolid() Boolean Units before trace exited a solid object.
trace() Trace Creates a trace.
trace(Vector, Vector, Number) Trace Creates a trace from (vector start) facing (vector direction) with (number length).
trace(Vector, Vector) Trace Creates a trace from (vector start) to (vector finish).
Trace:update() Void Gets updated trace results from a trace.
Trace:useLineOfSight(Boolean) Void Trace Mask:

EGP Component

The EGP (Expression Graphics Processor) is a wiremod entity that uses wirelinks to display and render information.

Function Return Description
Void
Wirelink:egpAlign(Number, Number) Void Change the horizontal alignment. Works on: text and text layout. Number can be 0, 1 or 2.
Wirelink:egpAlign(Number, Number, Number) Void Change the horizontal and vertical alignment. Works on: text and text layout. Numbers can be 0, 1 or 2.
Wirelink:egpAlpha(Number, Number) Void Sets the alpha of the given EGP object.
Wirelink:egpAlpha(Number) Number Returns the alpha of the given EGP object.
Wirelink:egpAngle(Number, Number) Void Sets the angle of the given EGP object.
Wirelink:egpAngle(Number, Vector2, Vector2, Number) Void Rotates the given EGP object around the first vec2 with the second vec2 as offset at angle N.
Wirelink:egpAngle(Number) Number Returns the angle of the given EGP object.
Wirelink:egpBox(Number, Vector2, Vector2) Void Creates a box object. Arguments are: Index, Position, Size.
Wirelink:egpBoxOutline(Number, Vector2, Vector2) Void Creates an outlined box object. Arguments are: Index, Position, Size.
egpCanSendUmsg() Boolean Returns true if an EGP usermessage can be sent.
Wirelink:egpCircle(Number, Vector2, Vector2) Void Creates a circle object. Arguments are: Index, Position, Size.
Wirelink:egpCircleOutline(Number, Vector2, Vector2) Void Creates an outlined circle object. Arguments are: Index, Position, Size.
Wirelink:egpClear() Void Resets the EGP.
Wirelink:egpColor(Number, Color) Void Sets the color of the given EGP object.
Wirelink:egpColor(Number) Color Returns the color of the given EGP object.
Wirelink:egpCopy(Number, Number) Void Clones the second object to the first object (will create a new object if it does not exist).
Wirelink:egpCursor(Entity) Vector2 Returns the on-screen aim position of the player.
Wirelink:egpDrawTopLeft(Boolean) Void If true, EGP objects will draw from the top left corner to the bottom right corner of the screen.
Wirelink:egpFidelity(Number, Number) Void Sets the fidelity (number of vertices) of the given egp object.
Wirelink:egpFidelity(Number) Number Returns the fidelity (number of vertices) of the given egp object.
Wirelink:egpFont(Number, String) Void Change the font. Works on: text and text layout.
Wirelink:egpFont(Number, String, Number) Void Change the font and size. Works on: text and text layout.
Wirelink:egpHasObject(Number) Boolean Returns true if the given EGP object is valid.
Wirelink:egpLine(Number, Vector2, Vector2) Void Creates a line object. Arguments are: Index, Position 1, Position 2
Wirelink:egpLoadFrame(String) Void Loads the frame with the name S.
Wirelink:egpMaterial(Number, String) Void Sets the material of the given EGP object.
Wirelink:egpMaterial(Number) String Returns the material of the given EGP object.
Wirelink:egpMaterialFromScreen(Number, Entity) Void Set the material of the given EGP object to the material from another RenderTarget screen.
egpMaxObjects() Number Returns the maximum amount of EGP objects allowed by the server.
egpMaxUmsgPerSecond() Number Returns the maximum amount EGP user messages allowed by the server.
Wirelink:egpNumObjects() Number Returns the amount of objects the EGP contains.
Wirelink:egpOrder(Number, Number) Void Set the order the given EGP object is rendered.
Wirelink:egpOrder(Number) Number Returns the order the given EGP object is rendered.
Wirelink:egpParent(Number, Entity) Void Parents a 3D tracker object to an entity (will not work for other objects).
Wirelink:egpParent(Number, Number) Void Parents the given EGP object to another object.
Wirelink:egpParent(Number) Number Returns the parent object of the given EGP object.
Wirelink:egpParentToCursor(Number) Void Parents the given EGP object to an EGP cursor.
Wirelink:egpPoly(Number, ...) Void Creates a polygon objects using a vararg of 2d vectors.
Wirelink:egpPolyOutline(Number, ...) Void Creates an outlined polygon objects using a vararg of 2d vectors.
Wirelink:egpPos(Number, Vector) Void Sets the position of a 3D tracker object (will not work for other objects).
Wirelink:egpPos(Number, Vector2) Void Sets the position of the given EGP object.
Wirelink:egpPos(Number) Vector2 Returns the position of the given EGP object.
Wirelink:egpRadius(Number, Number) Void Sets the corner radius of rounded boxes. Works on: rounded box and rounded box outline.
Wirelink:egpRadius(Number) Number Returns the corner radius of rounded boxes. Works on: rounded box and rounded box outline.
Wirelink:egpRemove(Number) Void Removes the given EGP object.
Wirelink:egpResolution(Vector2, Vector2) Void Sets the scale of the screen such that the top left corner is equal to the first vector and the bottom right corner is equal to the second vector.
Wirelink:egpRoundedBox(Number, Vector2, Vector2) Void Creates a rounded box object. Arguments are: Index, Position, Size.
Wirelink:egpRoundedBoxOutline(Number, Vector2, Vector2) Void Creates an outlined rounded box object. Arguments are: Index, Position, Size.
Wirelink:egpSaveFrame(String) Void Saves the current frame with the name S.
Wirelink:egpScale(Vector2, Vector2) Void Sets the scale of the screen's X axis to the first vector and Y axis to the second vector.
egpScrH(Entity) Number Returns the player's screen resolution height.
egpScrSize(Entity) Vector2 Returns the player's screen resolution.
egpScrW(Entity) Number Returns the player's screen resolution width.
Wirelink:egpSetText(Number, String) Void Changes the text. Works on: text and text layout.
Wirelink:egpSize(Number, Number) Void Change the size. Works on: Any object with width and height size (ie does not work on text, poly, triangle, etc. Note: does work on line).
Wirelink:egpSize(Number, Vector2) Void Change the position. Works on: Any object with x and y position (ie does not work on poly, line, triangle, etc).
Wirelink:egpSize(Number) Vector2 Returns the size. Works on: Any object with width and height size (ie box, circle, text layout, etc).
Wirelink:egpSizeNum(Number) Number Returns the number size. Works on: Any object with a number size (ie text, text layout, line, wedge, etc)
Wirelink:egpText(Number, String, Vector2) Void Creates a text object. Arguments are: Text, Position.
Wirelink:egpTextLayout(Number, String, Vector2, Vector2) Void Creates a text layout object. Arguments are: Text,Position, Size.
Wirelink:egpTrackerParent(Number) Entity Returns the parent entity of a 3d tracker object.
Wirelink:egpTriangle(Number, Vector2, Vector2, Vector2) Void Creates a triangle object. Arguments are: Position nr 1, Position nr 2, Position nr 3.
Wirelink:egpTriangleOutline(Number, Vector2, Vector2, Vector2) Void Creates an outlined triangle object. Arguments are: Position nr 1, Position nr 2, Position nr 3.
Wirelink:egpUnParent(Number) Void Remove the parenting of an object.
Wirelink:egpWedge(Number, Vector2, Vector2) Void Creates a wedge object. Arguments are: Position, Size. Wedge objects have a cake-piece-like mouth which you can change using egpSize.
Wirelink:egpWedgeOutline(Number, Vector2, Vector2) Void Creates an outlined wedge object. Arguments are: Position, Size. Wedge objects have a cake-piece-like mouth which you can change using egpSize.

Arrays Component

Arrays in Expression Advanced are type static, this means arrays may only store values of a specific type and can only be indexed by numbers.

Note: 2D arrays are not possible in Expression Advanced and this feature will not be added.

Example:

    number[] myArray = numberArray( )
    myArray[1] = 10
    print( myArray[1] )
Operator Return Description
(table) Array Table Casts the array into a (slower) table object.
#Table Number Returns the current size of the array.
Array[Number] Array Type Returns the value at index on the array.
Array[Number] = <array type> Void Sets the value at index on the array.
Function Return Description
<type>Array( ... ) Array Creates an array. E.G: numberArray( 1, 2, 3 ); stringArray( "test", "ing" )
Array:last( ) Array Type Returns the value on the highest index of the array.
Array:remove( Number ) Array Type Removes the value at index on the array and returns it.
Array:insert( Array Type ) Void Inserts a value to the top of the array.
Array:insert( Number, Array Type ) Void Inserts a value into the array at index and pushes all above index up.
Array:count( ) Number Returns the ammount of used indexs on the array (this is not size).
Array:clear( ) Void Clears all objects off the array.

Table Component

Expression Advanced supports a table object that is also used as arrays. Tables are defined between "{ }" using a comma to separate indexes. All tables in Expression Advanced begin at index 1, they may only be indexed by Numbers, Strings and Entities.

Note: The array element of a table is none type static like other arrays and tables are extremly slow in comparason.

Example:

    table A = { "string", "pie", vec(0, 0, 0) }
    table T = { 5 = "string", "pie" = vec(0, 0, 0) }
Operator Return Description
#Table Number Returns the current maximum numeric index of the tables array element.
Table[Number] Variant Returns the value at index Number on the table as a variant.
Table[String] Variant Returns the value at index String on the table as a variant.
Table[Entity] Variant Returns the value at index Entity on the table as a variant.
Table[Number] = <type> Void Sets the value at index Number on the table.
Table[String] = <type> Void Sets the value at index String on the table.
Table[Entity] = <type> Void Sets the value at index Entity on the table.
Table[Number,] <type> Returns the value at index Number on the table.
Table[String,] <type> Returns the value at index String on the table.
Table[Entity,] <type> Returns the value at index Entity on the table.
Table[Number,] = <type> Void Sets the value at index Number on the table.
Table[String,] = <type> Void Sets the value at index String on the table.
Table[Entity,] = <type> Void Sets the value at index Entity on the table.
Function Return Description
Table:add(Table) Void Adds the second table to the first.
Table:concat(String) String Concatenates a table into a string.
Table:copy() Table Copies a table to a new table.
Table:count() Number Returns the amount of entries in a table.
Table:exists(Entity) Boolean Returns true if (entity) exists in the table.
Table:exists(Number) Boolean Returns true if (number) exists in the table.
Table:exists(String) Boolean Returns true if (string) exists in the table.
Table:flip() Table
Table:insert(<type>) Void Inserts type to the bottom of a table.
Table:insert(Number, <type>) Void Inserts type to entry (number) of a table.
Table:insert(<type>) Void Inserts type to the bottom of a table.
Table:invert() Table Inverts a table and returns it as a new table.
Table:keys() Table
Table:maxIndex() Variant Returns the index (as variant) of the highest value on the table.
Table:merge(Table) Void Merges 2 tables into 1.
Table:minIndex() Variant Returns the index (as variant) of the lowest value on the table.
Table:pop() Variant Pops a value of the table and returns it as variant.
printTable(Table) Void prints the contents of a table.
Table:push(<type>) Void Pushes a type onto a table.
Table:remove(Entity) Variant Removes value at index E of table, the removed object is returned as variant.
Table:remove(Number) Variant Removes value at index N of table, the removed object is returned as variant.
Table:remove(String) Variant Removes value at index S of table, the removed object is returned as variant.
Table:shift() Variant
Table:shift(Number) Variant
Table:size() Number Returns the amount of entries in a table.
Table:sort(Function) Table
Table:type(Entity) String Returns the type of object stored in table at index.
Table:type(Number) String Returns the type of object stored in table at index.
Table:type(String) String Returns the type of object stored in table at index.
unpack(Table) ... Unpacks a table into a vararg.
Table:unshift(<type>) Void unshift value of a table.
Table:unshift(Number, <type>) Void unshift value of a table at index N.
Table:unshift(<type>) Void unshift value of a table.
Table:values() Table

Shared Tables

Shared tables are globally avaible between all LemonGates.

Function Return Description
getSTable(String) Table Returns the shared table named S.
getPrivateTable(String) Table Returns the privatly shared table named S.
removeSTable(String) Void Removed the shared table named S.
removePrivateTable(String) Void Removed the privatly shared table named S.
setSTable(String, Table) Void Sets a table to be shared under the name S.
setPrivateTable(String, Table) Void Sets a table to be privatly shared under the name S.

Meta Tables

If a table has a meta table set, it will return the value of its meta table when attempting to retrieve a value at a void index. This works for the meta table of a meta table, this also supports methods.

Function Return Description
setMetaTable(Table, Table) Table Sets the metatable used by the T1 to T2 and returns T1.
removeMetaTable(Table, Table) Void

Table Methods

Methods can be created on tables. Methods are basic lambda functions with an extra parameter for This (The table the method was called from).

    method T:example( string Arg ) {
        return This[1, string] + Arg
    }
    
    T:example( "!" )

Table methods also support the @return prediction operator:

    @return: T->example string

Meta Methods

Special method names are reserved on a table to be used as operators, this can be used with metatables to emulate custom classes.

Method Description Example
operator_string( This ) Cast table to string (string) Table.
operator_call( This, ... ) When calling a table Table( 1, 2, 3, ... ).
operator_addition( This, ? ) Addition of value to table Table + ?.
operator_subtraction( This, ? ) Subtraction of value to table Table - ?.
operator_multiply( This, ? ) Multiplication of value to table Table * ?.
operator_division( This, ? ) Division of value to table Table \ ?.
operator_modulus( This, ? ) Modulus of value to table Table % ?.
operator_exponent( This, ? ) Exponent of value to table Table ^ ?.
operator_equal( This, ? ) Table equal to ?, Must return boolean Table == ?.
operator_greater( This, ? ) Table greater than ?, Must return boolean Table > ?.

Note: All comparison operators use "operator_equal" and "operator_greater".

Custom Components

See: Custom Components Explains default custom components.