/** @file datautillua.h
 *  Some functionality to allow EA::Types values to be converted to and from LUA tables/values
 *	@author Chris Burns (cburns@ea.com)
 *
 *	UX
 *	(c) 2012 Electronic Arts Inc. 
 */

#ifndef EABASETYPESLUA_DATAUTILLUA_H_
#define EABASETYPESLUA_DATAUTILLUA_H_

#include "EABaseTypes/autoref.h"

extern "C"
{
	struct lua_State;
}

namespace EA
{
	namespace Types
	{
		EABASETYPES_FORWARD_DECLARATION(class, BaseType)
	}
}

namespace EA
{
	namespace Lua
	{
		/*!
		 *	push a BaseType as a LUA value on the stack. This is effectively a deep copy
		 *	@param[in]	L			lua_State* of the interpreter whose stack we are going to push this onto
		 *	@param[in]	baseType	BaseType* to push as a LUA value
		 */
		void PushBaseType(lua_State* L, EA::Types::BaseTypeIn baseType);

		/*!
		 *	convert a LUA value on the LUA stack into a BaseType. This is effectively a deep copy
		 *	@param[in]	L			lua_State* of the interpreter whose stack the LUA value is on
		 *	@param[in]	index		The LUA stack index to access
		 *	@return		BaseType*	A pointer to a new BaseType representing the LUA value
		 */
		EA::Types::BaseTypeReturn ToBaseType(lua_State* L, int index);
	}
}

#endif /* EABASETYPESLUA_DATAUTILLUA_H_ */
