Ok, so for a request for Gotcha! I want to make a one-use healing gun. After browsing the LuaDocs, I see two possible ways to do the self-gibbing. One, it looks like there's an "IsActivated" function on HeldDevices, so could I do this in Update()?
Code:
if IsActivated() then
(stuff)
self.GibThis();
end
Or, another way Grif said is the option, having a particle do the Lua in it's Create() function. Would the particle be able to access that which it was fired from, like self.Parent.GibThis()?
EDIT: Got that done.
NOW, how do I retrieve a method from a dofile? I tried dofile("file"):method(params);, but that failed mightily, as well as just plain dofile("file"); and later self:method(params);, and the same but without the self:.