Ejemplo n.º 1
0
NzString NzLuaInstance::DumpStack() const
{
	NzStringStream stream;
	unsigned int stackTop = GetStackTop();
	stream << stackTop << " entries\n";

	for (unsigned int i = 1; i <= stackTop; ++i)
	{
		stream << i << ": ";
		switch (GetType(i))
		{
			case nzLuaType_Boolean:
				stream << "Boolean(" << ToBoolean(i) << ')';
				break;

			case nzLuaType_Function:
				stream << "Function(" << ToPointer(i) << ')';
				break;

			case nzLuaType_LightUserdata:
			case nzLuaType_Userdata:
				stream << "Userdata(" << ToUserdata(i) << ')';
				break;

			case nzLuaType_Nil:
				stream << "Nil";
				break;

			case nzLuaType_None:
				stream << "None";
				break;

			case nzLuaType_Number:
				stream << "Number(" << ToNumber(i) << ')';
				break;

			case nzLuaType_String:
				stream << "String(" << ToString(i) << ')';
				break;

			case nzLuaType_Table:
				stream << "Table(" << ToPointer(i) << ')';
				break;

			case nzLuaType_Thread:
				stream << "Thread(" << ToPointer(i) << ')';
				break;

			default:
				stream << "Unknown(" << ToPointer(i) << ')';
				break;
		}

		stream << '\n';
	}

	return stream.ToString();
}
Ejemplo n.º 2
0
void NzMappedNoiseBase::SetResolution(float resolution)
{
    if (NzNumberEquals(resolution, 0.f))
	{
		NzStringStream ss;
		ss << __FILE__ << ':' << __LINE__ << " : resolution cannot be 0.0f";

		throw std::domain_error(ss.ToString());
	}
    m_resolution = resolution;
}