How to fire an Input via "lua_run" entity?

I want to add a special easter egg in my map (Garry’s Mod) that checks my SteamID, and if it’s equal to the one specified in the code, it will fire an “Open” input of a Func_Door called “TestDoor”.
However, “ent_fire” is blocked in “RunConsoleCommand”, and I have no idea how to use the “Entity.Input” and “Entity.Fire” in Lua.

How do I specify what entity do I want to send the Input to? I keep getting this error.

[ERROR] RunString:1: attempt to index global 'Entity' (a function value)

Changing the “Entity” to “TestDoor” doesn’t work either.

[ERROR] RunString:1: attempt to index global 'TestDoor' (a function value)

basically, get the entity that you want to fire.

local ent = yourentityhere()
ent:Fire(“input”, “argsandshit”)

I’ve tried that, and got this error.
Also, I’m really new to Lua, so excuse me if I’m doing something stupid. >.>

Try passing 0 as a string “0” instead.

[editline]29th March 2014[/editline]

Oh, also TestDoor() isn’t an actual function, so it doesn’t return any entities. Try ents.FindByClass and use the resulting table to fire all the doors using key value in pairs.

Thanks for the help, I’ve used ents.FindByName, as the selection is much thinner then. Here’s the full script, if anyone’s interested.

hook.Add('PlayerUse', 'Button', function(ply,ent) if(ent:GetName()=='Button') then if(ply:SteamID()=='STEAM_0:0:36158367') then local doors = ents.FindByName('TestDoor') for j = 1, #doors do doors[j]:Fire('Open', 1) end end end end )

Replace Button with the func_button’s name you want to use, STEAM_0:0:36158367 with the your SteamID, TestDoor with the entity’s name whose input you want to fire, and Open with the input name. Remember to use ‘string’ in Hammer instead of “string”, otherwise your .VMF will get corrupted. Also, don’t abuse this to destroy the server you’re playing on. :L

Unless there’s more than one TestDoor, I don’t see why you shouldn’t use ents.FindByName(‘TestDoor’)[1] instead of that loop.