Don’t know the real name for the functionallity in JavaScript, but it’s used like this e.g.
[javascript]
var myObj = {};
myObj.myVariable = (function()(
// … do stuff
return someObj;
}());
[/javascript]
the myObj.myVariable gets whatever value is returned without me ever having to call some function or initialize it myself.
Now to my question: Is it possible do achieve the same effect in Lua? So when I want to use a variable, its value comes from a function that’s “pre-run” and the variable already has its value.
[import]uid: 43027 topic_id: 8001 reply_id: 308001[/import]