Hey everyone.
Some relevant history: I used to live my life in Flash, particularly ActionScript, so most of my [limited] coding experience stems from that bygone era. I mention that because I'm having some trouble figuring out how to do a few things.
I have a .nut in which I'm placing a bunch of objects -- tables in Squirrel-speak, right? When I place the following in my layout.nut: fe.do_nut(filename.nut), which contains a few tables, if I try to access those tables later in my layout, I get a message saying they don't exist. Am I misunderstanding how do_nut works?
Second, in this external file (and I've tried in the main layout.nut, too), my objects (tables?) have names like rom_1942 or rom_bgaregga. What I'm trying to do is, on transition (that's another bag of fun I haven't figured out), combine the prefix rom_ with the results of fe.game_info(Info.Name) to access the equivalent table and its slots (e.g., rom_1942.btn1). Is there a way to reference a table when its name is composited like that? In javascript, I could do something like this:
var rom_1942 = { "btn1": "Fire", "btn2": "Loop" };
var pref = "rom_";
var romname = "1942";
console.log(window[pref + romname].btn1); // Outputs "Fire"
I'm partially thinking out loud here, and I don't have access to my AM machine right now...I guess my question about accessing indeterminate objects is what's the right way to access them? Could I use fe[pref + romname] and read its properties that way?
And since I'm here and rambling, are there any good, initially simple examples of how to get fe.add_transition_callback() to work? I've done something like this with no results:
function doStuff (ttype, var, ttime) {
print ("ttype: " + ttype); // Never fires?
return false;
}
...
fe.add_transition_callback(doStuff);
Clearly, I don't know what I'm doing. Thanks for any advice or insight!