1 | // returns an object with a "strategy" method |
2 | static O loadStrategy(S id) { |
3 | int type = getSnippetType(id); |
4 | if (type == 34) { |
5 | // JavaX Strategy |
6 | final O strategy = run(id); |
7 | ret strategy; |
8 | } else { |
9 | // Lua Strategy |
10 | S lua = loadSnippet(id); |
11 | Sandbox s = luaSandbox(); |
12 | evalLua(s, lua); |
13 | final LuaValue strategy = s.get("strategy"); |
14 | assertNotNil(strategy); |
15 | ret new O { |
16 | S strategy(S text) { |
17 | ret callLuaStrategy(strategy, text); |
18 | } |
19 | }; |
20 | } |
21 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1004731 |
Snippet name: | loadStrategy |
Eternal ID of this version: | #1004731/1 |
Text MD5: | 654af3a28a43733bbb344d758bb00109 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-09-11 23:17:00 |
Source code size: | 517 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 470 / 487 |
Referenced in: | [show references] |