Página 1 de 2
lua code debugger
Publicado: 08 May 2020 12:38
por mahdi1993
Hi all
Is there a way to show lua script errors before run it?
Exactly like "Syntax Check" in ams
I searched a lot in web but i cant find anything
Somebody help me

Re: lua code debugger
Publicado: 08 May 2020 14:29
por usamakey
Re: lua code debugger
Publicado: 09 May 2020 01:37
por Dow Sher
En la pestaña script >> click derecho

Re: lua code debugger
Publicado: 14 May 2020 21:26
por mahdi1993
thanks guys
I meant something else
I want to create my own code editor that name is lua studio

I want to check script and show syntax errors to user
not in external editors
Re: lua code debugger
Publicado: 23 May 2020 13:31
por usamakey

LUAStudio release 0.10 build 10 by Michal Kowalski
MEGA.NZ
- HIDE: ON
- Hidebb Message Hidden Description
Re: lua code debugger
Publicado: 23 May 2020 14:58
por YHWH
Thank you I will test
Re: lua code debugger
Publicado: 24 May 2020 14:23
por mahdi1993
thank you friends
but i want code to find syntax errors in my own code editor
Re: lua code debugger
Publicado: 25 May 2020 14:33
por abood1987
@ mahdi1993 You mean to show such a list? When writing?

Re: lua code debugger
Publicado: 26 May 2020 09:07
por mahdi1993
Hi all.
no abood. i mean when if press F5 for run script
my app, first check syntax errors before run and show syntax error to user
like when user write some code in ams and click F12 for syntax check!
can you understand me?
Re: lua code debugger
Publicado: 11 Jul 2020 00:27
por mahdi1993
@abood1987 i see a topic about LuaLint that started by pobloco
I want a plugin to check lua code before run it and show the errors
I think LuaLint is good idea for it
Can you put the LuaLint downnload link with an example here? please!
Thanks
Re: lua code debugger
Publicado: 11 Jul 2020 21:34
por abood1987
welcome mahdi
Why not use
assert for this jop and the example :
--
function sum(n)
return (n*n - n)/2;
end
local s = 0
for i=1,100 do
s = s + i
assert(sum(i) == s, "Case "..i.." failed: expected "..s.." but got "..sum(i).." instead.")
end
or
--
file = _DesktopFolder.."\\new 1.lua";
local tbl, err = assert(loadfile(file, "t"))
Re: lua code debugger
Publicado: 12 Jul 2020 20:38
por mahdi1993
Hi abood.
Because of 2 problem :
1 - In your example, assert function will not show line off error!
2 - for use assert i need save scripts in a lua file and then debug it. but i want check syntax error at runtime without save it!
However thanks
Re: lua code debugger
Publicado: 12 Jul 2020 20:57
por abood1987
mahdi1993 escribió: ↑12 Jul 2020 20:38
Hi abood.
Because of 2 problem :
1 - In your example, assert function will not show line off error!
2 - for use assert i need save scripts in a lua file and then debug it. but i want check syntax error at runtime without save it!
However thanks
This means that you want to make a project with the element scintilla ?
Re: lua code debugger
Publicado: 12 Jul 2020 21:39
por mahdi1993
abood1987 escribió: ↑12 Jul 2020 20:57
mahdi1993 escribió: ↑12 Jul 2020 20:38
Hi abood.
Because of 2 problem :
1 - In your example, assert function will not show line off error!
2 - for use assert i need save scripts in a lua file and then debug it. but i want check syntax error at runtime without save it!
However thanks
This means that you want to make a project with the element scintilla ?
Listen to me dear friend
I write below code in ams and when i tried to run it, an error accrued :
Now i want build my self lua code debugger :
What code i should put in "Check Syntax" button to show syntax errors before run it ???
Re: lua code debugger
Publicado: 12 Jul 2020 22:58
por abood1987
mahdi1993 escribió: ↑12 Jul 2020 21:39
What code i should put in "Check Syntax" button to show syntax errors before run it ???
if you used
Scintilla Object Plugin then just use this code on " Check Syntax button " :
--
nlen = Scintilla.SendMessage("Plugin1", MinTabIndex, "num", SCI_GETLENGTH, "num", 0, "num", 0);
ret , text = Scintilla.SendMessage("Plugin1", MinTabIndex, "num", SCI_GETTEXT, "num", nlen+1, "pstr", nlen);
loadstring (text)();
It is not what you want it but unfortunately this is what I know

Re: lua code debugger
Publicado: 13 Jul 2020 20:09
por mahdi1993
Thank you dear abood so much.
loadstring function will not show line of error
I see a plugin that pabloco was created for notepad++ (LuaLint)
I mean something like it for debugging lua codes
Re: lua code debugger
Publicado: 14 Jul 2020 21:18
por Pabloko
Using loadstring can have side effects because youre EXECUTING it. its better to not execute random code.
Re: lua code debugger
Publicado: 14 Jul 2020 22:27
por abood1987
Pablo So what is the ideal way to do this job
I really want to get an answer for this too Is there a function in AMS to do this or any dll ?
This question is worth searching for an answer to him
Only the developers of the AMS knows?

Re: lua code debugger
Publicado: 14 Jul 2020 23:12
por abood1987
may be used
xpcall
--
function myfunction ()
n = n/nil
end
function myerrorhandler( err )
Dialog.Message( "ERROR:", err )
end
status = xpcall( myfunction, myerrorhandler )
--Dialog.Message("Message",type(status))
Re: lua code debugger
Publicado: 15 Jul 2020 00:53
por abood1987
or look at
LuaLint Plugin for NotePad++ again
After placing lualint.dll file in Scripts folder in your Project
nlen = Scintilla.SendMessage("Plugin1", MinTabIndex, "num", SCI_GETLENGTH, "num", 0, "num", 0);
ret , text = Scintilla.SendMessage("Plugin1", MinTabIndex, "num", SCI_GETTEXT, "num", nlen+1, "pstr", nlen);
require("LuaLint")
err = lualint(text)
if (err~=nil) then
Dialog.Message('lua error', err)
end