From a77cec2aea7d7f3c345eb26e84c9eeefdd8d9ae0 Mon Sep 17 00:00:00 2001 From: Cloud Wu Date: Fri, 29 Aug 2014 12:07:09 +0800 Subject: [PATCH] add example injectlaunch to show how to inject code --- examples/injectlaunch.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 examples/injectlaunch.lua diff --git a/examples/injectlaunch.lua b/examples/injectlaunch.lua new file mode 100644 index 00000000..4a0028c0 --- /dev/null +++ b/examples/injectlaunch.lua @@ -0,0 +1,19 @@ +if not _P then + print[[ +This file is examples to show how to inject code into lua service. +It is used to inject into launcher service to change the command.LAUNCH to command.LOGLAUNCH. +telnet the debug_console service (nc 127.0.0.1 8000), and run: +inject 3 examples/injectlaunch.lua -- 3 means launcher service +]] + return +end +local command = _P.lua.command + +if command.RAWLAUNCH then + command.LAUNCH, command.RAWLAUNCH = command.RAWLAUNCH + print "restore command.LAUNCH" +else + command.RAWLAUNCH = command.LAUNCH + command.LAUNCH = command.LOGLAUNCH + print "replace command.LAUNCH" +end