scripted_ents.Register

From GMod Wiki

Jump to: navigation, search
Warning 64 light.png Internal Function: scripted_ents.Register
scripted_ents.Register is an internal function. This means you will be able to call it, but you really shouldn't.


Function
Syntax scripted_ents.Register( Table t, String name, Boolean reload )
Where is this used?
Description:
Registers a new entity type and it's table to the scripted entities list.
Returns: nothing
Part of Library: scripted_ents
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Scripted ents.Register]Scripted ents.Register [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionRegister the entity 'test_entity' which will spam console with "Works!" when spawned.
Used onNewerShared.png
Code
scripted_ents.Register({
	Type = "anim",
	Think = function()
		print("Works!")
	end
}, "test_entity", false)
hook.Add("Initialize", "scripted_ents.Register test", function()
	local test_ent = ents.Create("test_entity")
	test_ent:Spawn()
end)
 
OutputWill spam console with "Works!".

Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox