Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add text length limit to egp objects #3269

Merged
merged 1 commit into from
Feb 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lua/entities/gmod_wire_expression2/core/egpfunctions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,15 @@ end
--------------------------------------------------------
e2function egpobject wirelink:egpText( number index, string text, vector2 pos )
if (!EGP:IsAllowed( self, this )) then return NULL_EGPOBJECT end
if #text>256 then text = string.sub(text, 1, 256) end
local bool, obj = egp_create("Text", { index = index, text = text, x = pos[1], y = pos[2] }, this)
if (bool) then EGP:DoAction( this, self, "SendObject", obj ) Update(self,this) end
return obj
end

e2function egpobject wirelink:egpTextLayout( number index, string text, vector2 pos, vector2 size )
if (!EGP:IsAllowed( self, this )) then return NULL_EGPOBJECT end
if #text>256 then text = string.sub(text, 1, 256) end
local bool, obj = egp_create("TextLayout", { index = index, text = text, x = pos[1], y = pos[2], w = size[1], h = size[2] }, this)
if (bool) then EGP:DoAction( this, self, "SendObject", obj ) Update(self,this) end
return obj
Expand All @@ -193,6 +195,7 @@ __e2setcost(10)
----------------------------
e2function void wirelink:egpSetText( number index, string text )
if (!EGP:IsAllowed( self, this )) then return end
if #text>256 then text = string.sub(text, 1, 256) end
local bool, k, v = hasObject(this, index)
if (bool) then
if v:EditObject({ text = text }) then EGP:DoAction( this, self, "SendObject", v ) Update(self,this) end
Expand Down
Loading