12
LINES
Source file
1 | package tb; |
2 | |
3 | import net.luaos.tb.common.Solution; |
4 | |
5 | /** treats input as Lua expression, evaluates it and returns result (as string) */ |
6 | public class sol_lua_eval extends Solution { |
7 | public String compute(String input) { |
8 | // We need a full statement, not just an expression, so we add "return" |
9 | String code = "return (" + input + ")"; |
10 | return sol_lua.callLuaSolution(sol_lua.createLuaEnvironment(), code, null); |
11 | } |
12 | } |
download show line numbers
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Image recognition results
| Snippet ID: |
#14 |
| Snippet name: |
tb/sol_lua_eval.java |
| Eternal ID of this version: |
#14/1 |
| Text MD5: |
a006981982f4337c3b46b52ae0751970 |
| Author: |
stefan |
| Category: |
|
| Type: |
Source file |
| Public (visible to everyone): |
Yes |
| Archived (hidden from active list): |
No |
| Created/modified: |
|
| Source code size: |
424 bytes / 12 lines |
| Pitched / IR pitched: |
No / No |
| Views / Downloads: |
1351 / 386 |
| Referenced in: |
[show references] |