Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- isStopped = false
- f = nil
- function GetCurrentTimeStr()
- return os.date("%d.%m.%Y").." "..os.date("%X",os.time())
- end;
- function WriteLog(logstr)
- f:write(GetCurrentTimeStr().." "..logstr.."\n");
- end;
- function OrderTableToStr(order)
- return "num:"..tostring(order["order_num"]).."|transaction:"..tostring(order["trans_id"]).."|flags:"..tostring(order["flags"])
- end;
- function OnStop()
- isStopped = true;
- end;
- function OnOrder(order)
- WriteLog(OrderTableToStr(order));
- f:flush();
- end
- function main()
- PrintDbgStr("script started")
- f_name = "_myLuaLog.txt"
- f = io.open(f_name, "r+");
- if f == nil then
- f = io.open(f_name, "w");
- f:close();
- f = io.open(f_name, "r+");
- end;
- f:seek("end");
- WriteLog("Script Started");
- while not isStopped do
- sleep(100)
- end
- WriteLog("Script Stopped\n");
- f:flush();
- f:close();
- PrintDbgStr("script stopped")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement