lua code debugger

Aquí podrás hablar de cualquier tema que no tenga un sección específica.
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
Imagen
En la pestaña script >> click derecho

Imagen
thanks guys
I meant something else
I want to create my own code editor that name is lua studio
Imagen
I want to check script and show syntax errors to user
not in external editors


Imagen


LUAStudio release 0.10 build 10 by Michal Kowalski



MEGA.NZ
HIDE: ON
Hidebb Message Hidden Description



Thank you I will test
thank you friends
but i want code to find syntax errors in my own code editor
@ mahdi1993 You mean to show such a list? When writing?

Imagen
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?
@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
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"))
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
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 ?
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 :
Imagen

Now i want build my self lua code debugger :
Imagen

What code i should put in "Check Syntax" button to show syntax errors before run it ???
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 :yeah-1417757020:
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
Using loadstring can have side effects because youre EXECUTING it. its better to not execute random code.
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? :yeah-1417757020:
may be used xpcall :dancing:
--
function myfunction ()
   n = n/nil
end

function myerrorhandler( err )
   Dialog.Message( "ERROR:", err )
end

status = xpcall( myfunction, myerrorhandler )
--Dialog.Message("Message",type(status))
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