示例#1
0
void LuaManager::ConvertVec3ToTable(const XMFLOAT3& vec, LuaPlus::LuaObject& outLuaTable) const
{
	outLuaTable.AssignNewTable(GetLuaState());
	outLuaTable.SetNumber("x", vec.x);
	outLuaTable.SetNumber("y", vec.y);
	outLuaTable.SetNumber("z", vec.z);
}
示例#2
0
LuaPlus::LuaObject InternalScriptExports::GetVectorFromRotation(float angleRadians)
{
    Vec3 result = ::GetVectorFromYRotation(angleRadians);
    LuaPlus::LuaObject luaResult;
    luaResult.AssignNewTable(LuaStateManager::Get()->GetLuaState());
    luaResult.SetNumber("x", result.x);
    luaResult.SetNumber("y", result.y);
    luaResult.SetNumber("z", result.z);
    return luaResult;
}
示例#3
0
static LuaPlus::LuaObject Wrap(Vec3 vector){
	LuaPlus::LuaObject vecObj;
	vecObj.AssignNewTable(LuaManager::Get()->GetState());

	vecObj.SetNumber("x", vector.x);
	vecObj.SetNumber("y", vector.y);
	vecObj.SetNumber("z", vector.z);

	return vecObj;
}
示例#4
0
static LuaPlus::LuaObject Wrap(Quat quat){
	LuaPlus::LuaObject quatObj;
	quatObj.AssignNewTable(LuaManager::Get()->GetState());

	quatObj.SetNumber("w", quat.w);
	quatObj.SetNumber("x", quat.x);
	quatObj.SetNumber("y", quat.y);
	quatObj.SetNumber("z", quat.z);

	return quatObj;
}
// create a lua vec3 table from an angle in radians
LuaPlus::LuaObject LuaInternalScriptExports::GetVectorFromRotation(float angleRadians)
{
	// use the GetVectorFromYRotation from math.h
	Vec3 result = ::GetVectorFromYRotation(angleRadians);

	// create a lua vec3 table from the result
	LuaPlus::LuaObject luaResult;
	luaResult.AssignNewTable(LuaStateManager::Get()->GetLuaState());
	luaResult.SetNumber("x", result.x);
	luaResult.SetNumber("y", result.y);
	luaResult.SetNumber("z", result.z);

	return luaResult;
}
 // /////////////////////////////////////////////////////////////////
 //
 // /////////////////////////////////////////////////////////////////
 LuaPlus::LuaObject SliderControl::VGetLuaData()
 {
     LuaPlus::LuaObject table;
     table.AssignNewTable(g_appPtr->GetLuaStateManager()->GetGlobalState().Get());
     table.SetNumber("SliderPosition", m_sliderPos);
     table.SetInteger("EventTypeId", m_eventTypeId);
     table.SetInteger("ScreenElementId", VGetId());
     return (table);
 }
示例#7
0
//---------------------------------------------------------------------------------------------------------------------
// This function is called to register an event type with the script to link them.  The simplest way to do this is 
// with the REGISTER_SCRIPT_EVENT() macro, which calls this function.
//---------------------------------------------------------------------------------------------------------------------
void ScriptEvent::RegisterEventTypeWithScript(const char* key, EventType type)
{
	// get or create the EventType table
	LuaPlus::LuaObject eventTypeTable = LuaStateManager::Get()->GetGlobalVars().GetByName("EventType");
	if (eventTypeTable.IsNil())
		eventTypeTable = LuaStateManager::Get()->GetGlobalVars().CreateTable("EventType");

	// error checking
	GCC_ASSERT(eventTypeTable.IsTable());
	GCC_ASSERT(eventTypeTable[key].IsNil());
	
	// add the entry
	eventTypeTable.SetNumber(key, (double)type);
}
示例#8
0
        void LuaScriptEventManager::RegisterEventTransformer(LuaScriptEventTransformation transformer, EventType type, LPCSTR name)
        {
            LuaScript* luas = (LuaScript*)chimera::g_pApp->GetScript();
            LuaPlus::LuaObject table = luas->GetState()->GetGlobals().GetByName("EventType");

            if(table.IsNil())
            {
                table = luas->GetState()->GetGlobals().CreateTable("EventType");
            }

            table.SetNumber(name, type);

            m_transformMap[type] = transformer;
        }
示例#9
0
void ant::LuaStateManager::convertVec2ToTable(const sf::Vector2f& vec, LuaPlus::LuaObject& vec2Table)
{
	vec2Table.AssignNewTable(getLuaState());
	vec2Table.SetNumber("x", vec.x);
	vec2Table.SetNumber("y", vec.y);
}