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

Store all Lua outputs in controller, not in all entities #5

Open
TIMONz1535 opened this issue Jun 27, 2022 · 0 comments
Open

Store all Lua outputs in controller, not in all entities #5

TIMONz1535 opened this issue Jun 27, 2022 · 0 comments
Labels
invalid This doesn't seem right question Further information is requested

Comments

@TIMONz1535
Copy link
Owner

TIMONz1535 commented Jun 27, 2022

Need to rewrite the storing of callback functions in the controller itself and make a quick way to lookup them.
Now all functions are stored in different entities, it's not bad, and it's easy to lookup, but it's harder to clean.

Facepunch/garrysmod-requests#1911 (comment)

local unique_name = "i_" .. tostring( target:GetCreationID() ) .. name .. delay .. max_times
self.m_callbacks[unique_name] = fn

...

local kv = table.concat( { "gmod_outputhandler", unique_name, "", delay, max_times }, ":" )
target:Fire( "AddOutput", output .. " " .. kv, 0 )

...

-- lookup
local fn = self.m_callbacks[name]

I would experiment and see what is better.

By the way, now if the entity with Lua outputs is removed, then its functions are also removed. When they are stored in the controller it won't work(

@TIMONz1535 TIMONz1535 added question Further information is requested invalid This doesn't seem right labels Jul 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant