// returns an object with a "strategy" method static O loadStrategy(S id) { int type = getSnippetType(id); if (type == 34) { // JavaX Strategy final O strategy = run(id); ret strategy; } else { // Lua Strategy S lua = loadSnippet(id); Sandbox s = luaSandbox(); evalLua(s, lua); final LuaValue strategy = s.get("strategy"); assertNotNil(strategy); ret new O { S strategy(S text) { ret callLuaStrategy(strategy, text); } }; } }