-
Notifications
You must be signed in to change notification settings - Fork 333
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 setClipboardText(s) #2922
Add setClipboardText(s) #2922
Conversation
Add function to set clipboard text
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just curious, what's the intended use-case for this extension?
lua/entities/gmod_wire_expression2/core/custom/cl_clipboard.lua
Outdated
Show resolved
Hide resolved
I want to be able to copy a players SteamID so I can paste it into tools outside of the game. |
I'm not sure this belongs in wiremod at all |
Only problem I have with it is the excessive limits we're gonna need to implement since E2 doesn't have a client realm yet. If we have concmd, why not this? I don't see much point in it right now tho. Why not just implement said moderation tools with http inside E2? |
Moved setClipboardText(s) from its own extension to debug. Also moved e2helper description to a more appropriate location
Added a convar to limit the amount of characters the server is willing to send. Made use of `#` operator Limit check now returns nil
Added a cooldown convar and fixed limit test
return self:throw("setClipboardText exceeding string limit of " .. clipboard_character_limit:GetInt() .. " characters", nil) | ||
end | ||
|
||
timer.Create( timerid, clipboard_cooldown:GetInt(), 1, function() timer.Remove(timerid) end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Timer should remove itself since it only has one rep
I think you'd be better off keeping the last time it was called as a variable somewhere and checking if it has been a second instead of this timer solution.
We really need a generic limit system
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be alright to use a global table for tracking each E2 and storing the the last time it was called as the value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at how other extensions have done it, I don't have time to dig up examples right now but I'm sure some of them do basically what vurv is talking about
edit: ok it looks like you may have already done it, nevermind
oops forgot to remove that
Change to some less confusing
minor nitpicks, I agree its nicer.
Removed timer as suggested and added table to track when last called.
Add function to set clipboard text
Looking for any feedback, I'm sure I overlooked a few things.