Wednesday, 16 February 2011

No classes and objects in Lua. So...



So let's use old-C structs :D
How?
Image a struct to define a 2d point. It will looks like

struct Point2DStruct{
    double x;
    double y;
};

typedef struct Point2DStruct Point2D;

Point2D* new_Point2D(double x, double y){
    Point2D* result;
    result=(Point2D*)malloc(sizeof(Point2D));
    result->x=x;
    result->y=y;
    return result;
}

How we can do something similiar in Lua? With a table!

function new_Point2D(newx,newy)
    result={x=newx,y=newy};
    return result;
end

Easy, fast, and good looking. Well, you can also implement objects and classes using metatables. But I prefer using this "structured" way, because it's easier to read a to write.

Tuesday, 15 February 2011

No Memory on iPhone?

A rumor about new iPhone nano: they could be sold without memory, downloading dinamically from network. A storage location already exists: it's MobileMe.
It could be an interesting idea: but how much will cost in Italy, where our 3G network is expensive as gold?

Monday, 14 February 2011

Meanwhile, in HP

While Nokia is trying to understand where it's going, HP released yesterday THREE devices based on its WebOS platform:

      A big-screen smartphone
      The smallest smartphone aviable
      A tablet

It's interesting! Very interesting! Even if it could be a flop, HP is moving on!

Friday, 11 February 2011

Windows Phone 7: who cares?

Nokia decided today to pass from Symbian to Windows Phone 7. A MeeGo terminal is just promised: this is Nokia's new line.
I am a bit disappointed: Nokia has QT, MeeGo and other interesting platforms. Windows 7 isn't so exciting.