mirror of
https://github.com/wiremod/wire.git
synced 2025-03-04 03:03:04 -05:00
Add text length limit to egp objects (#3269)
This commit is contained in:
parent
dbed3cf164
commit
03162ba839
@ -174,6 +174,7 @@ 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
|
||||
@ -181,6 +182,7 @@ 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
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user