Skip to content

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

@TIMONz1535

Description

@TIMONz1535

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(

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem rightquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions