Attempt to index a global 'ENT' A nill value

I am creating an addon to autospawn a ENT when the hook InitPostEntity goes through. I have coding mostly correct I only have this one error I dont know how to get through. Heres the error:

[ERROR] addons/apbrjokerbox/lua/autorun/server/shared.lua:1: attempt to index global ‘ENT’ (a nil value)

  1. unknown - addons/apbrjokerbox/lua/autorun/server/shared.lua:1

Heres the code.

 -- Init.lua
 AddCSLuaFile( "shared.lua" )
 AddCSLuaFile( "cl_init.lua" )

 include( "shared.lua" )

 hook.Add( "InitPostEntity", "create_jbox", function()
	local box = ents.Create( "prop_dynamic" )
	box:SetUseType( SIMPLE_USE )
	box:SetModel( "models/bonkaddict/apb/jokerammo/ammovendingmachine.mdl" )
	box:SetPos( 4066.561523, -3812.723877, 242.788712 )
	box:PhysicsInit( SOLID_VPHYSICS )
	box:SetSolid( SOLID_VPHYSICS )
	box.isRunning = false
	local phys = box:GetPhysicsObject()
	if (phys:IsValid()) then
 end )
-- shared.lua
 ENT.Type = "anim"
 ENT.Base = "base_gmodentity"

 ENT.PrintName = "JokerAmmo Box"
 ENT.Spawnable = true
 ENT.Category = "APB JokerAmmo"

Any help is appreciated.

The game reads through the lua entities folder to make note of all the code for each lua-defined entity. It stores this data temporarily in a global variable called ENT. This way, the game can just run include() on a lua entity file, and the file will put all of its information into the global ENT table. Then the code that figures out the entity folder copies it off the ENT variable into one that it manages internally.

What this means is that ENT is meaningless except inside of the lua entities folder.

Autorun is not the lua entities folder.

You’re looking for addons/apbrjokerbox/lua/entities.

[editline]30th October 2016[/editline]

and make a folder inside of THAT, too

so addons/apbrjokerbox/lua/entities/entityname/blah.lua

Will do, some guy that helped me about 2 weeks ago said to put it in a autorun folder.

[editline]30th October 2016[/editline]

What ever I managed to do broke most things xD.
gmod_hands[62]:SetPos( -1.#IND00 -1.#IND00 -1.#IND00 ): Ignoring unreasonable position.
On like every prop spawn some addons arent even working anymore.

[(Official) Gravity Hull Designator - Localized Physics & Infinite Maps] lua/maprepeat/sh_main.lua:89: attempt to index local ‘pos’ (a number value)

  1. PosToCell - lua/maprepeat/sh_main.lua:89
  2. SetPos - lua/gravityhull/sh_entityoverrides.lua:198
    3. fn - addons/apbrjokerbox/lua/entities/apbrjokerbox/init.lua:10 << Im guessing it doesnt like the pos becuase that line is box:SetPos( 4066.561523, -3812.723877, 242.788712 )
    4. unknown - addons/ulib/lua/ulib/shared/hook.lua:109

EDIT 2: Thanks “bitches” that helped and turns out I was missing Vector() in the setpos thanks bitches :smiley: