I'd write:
local foo = t.foo; if not foo then foo = whatever; t.foo = foo end // Lua
(i.e. first assign the local, to reassign this local to the t field).
If you don't need to assign t.foo itself, you can of course write:
local foo = t.foo or whatever; // Lua
In C, I'd use chained assignements:
/*auto or register*/ Object *foo = t.foo = t.foo || whatever; // C
Stricter variant _javascript_/Java/C#/C++ (if the || operator is overloaded or only returns a boolean):
/*local or var*/ foo = t.foo = (t.foo == null ) && t.foo || whatever; // _javascript_
Object foo = t.foo = (t.foo == null ) && t.foo || whatever; // Java
/*auto or register*/ Object *foo = t.foo = (t.foo == null ) && t.foo || whatever; // C++
But Lua still does not like chained assignments in expressions (only supports assignments as separate instructions).