Hi there,
Can you tell me if it's possible to print a LUA script output to a file?
I've add some print command to a script set in the OnUserLoggedIn event but I'dd like to see what it output when it run. Only thing I see in the Domain Log is LUA script on event blabla executed successfully. I know I can copy and past it in the console on administration and get the output there but my problem happen only when it's fire by the event.
Thanks
Debugging lua script
-
- Site Admin
- Posts: 2090
- Joined: Tue Sep 29, 2009 6:09 am
Re: Debugging lua script
Yes, you can write the Lua script like this:
Code: Select all
local fp = assert(io.open("c:/output.log", "a+"))
fp:write("something happened!\n")
fp:close()
-
- Posts: 2
- Joined: Mon Jan 09, 2012 6:21 pm
Re: Debugging lua script
Ahhh indeed! Shame to myself for not having thought about it....
Thanks for your help.
Thanks for your help.
-
- Posts: 32
- Joined: Sat Mar 18, 2023 7:44 pm
Re: Debugging lua script
Can you write to the domain log ?FTP wrote: ↑Sat Sep 22, 2012 6:24 am Yes, you can write the Lua script like this:
Code: Select all
local fp = assert(io.open("c:/output.log", "a+")) fp:write("something happened!\n") fp:close()
-
- Site Admin
- Posts: 2090
- Joined: Tue Sep 29, 2009 6:09 am
Re: Debugging lua script
No, you can't. You can write something to system logs or admin logs only, just use the following lua APIs:
Code: Select all
c_AddSystemLog("xxxxxx", 1)
c_AddAdminLog("xxxxxx", 1)