void LuaScriptComponent::UnregisterScriptFunctions()
{
	// nil out the meta table object in lua
	LuaPlus::LuaObject metaTableObj = LuaStateManager::Get()->GetGlobalVars().Lookup(LUA_METATABLE_NAME);
	if (!metaTableObj.IsNil())
		metaTableObj.AssignNil(LuaStateManager::Get()->GetLuaState());
}
LuaPlus::LuaObject BaseScriptComponent::GetLookAt(void) const
{
    LuaPlus::LuaObject ret;

    shared_ptr<TransformComponent> pTransformComponent = MakeStrongPtr(m_pOwner->GetComponent<TransformComponent>(TransformComponent::g_Name));
    if (pTransformComponent)
        LuaStateManager::Get()->ConvertVec3ToTable(pTransformComponent->GetLookAt(), ret);
    else
        ret.AssignNil(LuaStateManager::Get()->GetLuaState());

    return ret;
}
LuaPlus::LuaObject LuaScriptComponent::GetPos()
{
	// return the objects position to lua
	LuaPlus::LuaObject ret;

	shared_ptr<TransformComponent> pTransformComponent = MakeStrongPtr(m_pOwner->GetComponent<TransformComponent>(TransformComponent::g_Name));
	if (pTransformComponent)
		LuaStateManager::Get()->ConvertVec3ToTable(pTransformComponent->GetPosition(), ret);
	else
		ret.AssignNil(LuaStateManager::Get()->GetLuaState());

	return ret;
}
void BaseScriptComponent::UnregisterScriptFunctions(void)
{
	LuaPlus::LuaObject metaTableObj = LuaStateManager::Get()->GetGlobalVars().Lookup(METATABLE_NAME);
	if (!metaTableObj.IsNil())
		metaTableObj.AssignNil(LuaStateManager::Get()->GetLuaState());
}