| 485 | } |
| 486 | |
| 487 | static int run_decompile_script(lua_State *L, char **argv, int script) |
| 488 | { |
| 489 | const char *fname = argv[script]; |
| 490 | bool is_bytecode_file = luaL_is_bytecode_file(L, fname); |
| 491 | if (!is_bytecode_file) |
| 492 | { |
| 493 | printf("decompile error, the input is not bytecode file\n"); |
| 494 | return LUA_ERRRUN; |
| 495 | } |
| 496 | boost::filesystem::path filepath(fname); |
| 497 | char error[LUA_VM_EXCEPTION_STRNG_MAX_LENGTH] = "\0"; |
| 498 | auto result = thinkyoung::lua::lib::decompile_bytecode_file_to_source_code(L, fname, filepath.stem().string(), error); |
| 499 | printf("decompiled result:\n%s", result.c_str()); |
| 500 | return LUA_OK; |
| 501 | } |
| 502 | |
| 503 | static int run_compile_script(lua_State *L, char **argv, int script) |
| 504 | { |
no test coverage detected