Nov 14, 2018

I think the game I’m looking forward to the most next year is Classic World of Warcraft. I spent a good chunk of my waking life playing WoW when it first came out. I even started a Monkey Island themed guild that sported over hundred members, most of which never got above level 12. But it was good times.
Here is the blog entry I write way back in 2005 on WoW
Nov 2, 2018
Doing testing on closures. This also makes my head hurt.
What do you think this will print?
local t = {
bar = 100
f = function() {
print(this.bar)
}
}
t2 <- {
bar = 200
}
t2.f <- t.f
local r = {
bar = 1000
function do_call(f) {
f()
}
}
r.do_call(t2.f)
Now with Answers
Well, not answers in the definitive truth of the universe way…
If you compile and run this code in Squirrel, the answer is 1000. This surprised me a little. I was expecting 200, but would have taken 100. As I build this new compiler, being some-what compatible with Squirrel is important, since I have a shit-lot of code already written in Squirrel that needs to run in the new compiler.