Moved reference counting to iScript from the Lua51Script. I need to investigate virtual inheritance and how it will interact with reference counting.
I am creating cast for CountedPtr to work in a similar fashion to dynamic_cast