package tb;
import net.luaos.tb.common.Solution;
/** treats input as Lua expression, evaluates it and returns result (as string) */
public class sol_lua_eval extends Solution {
public String compute(String input) {
// We need a full statement, not just an expression, so we add "return"
String code = "return (" + input + ")";
return sol_lua.callLuaSolution(sol_lua.createLuaEnvironment(), code, null);
}
}Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Recognizer | Recognition Result | Visualize | Recalc |
|---|---|---|---|
| #308 | 424 | [visualize] |
| 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: | 1350 / 385 |
| Referenced in: | #3000382 - Answer for ferdie (>> t = 1, f = 0) |