On Wed, Nov 24, 2010 at 1:57 PM, Andre Arpin <ar...@kingston.net> wrote: > SourceForge.net <nore...@...> writes: > >> The following code added to the CompileFunction solves the problem >> local firstLine = editor:GetTextRange(0, editor:PositionFromLine(1)) >> if string.sub(firstLine, 1,1) == '#' then >> editorText = '--' .. string.sub(editorText, #firstLine) >> end
This destroys the editorText string right? It only contains "--[contents after first line]". > the folloding code is better > > local editorText = iff(string.char(editor:GetCharAt(0)) == '#', > '\n'..editor:GetTextRange(editor:PositionFromLine(1), editor.Length), > editor.Text) I have applied a much simpler patch in CVS. I assume that you want to ignore the "#!/bin/lua" at the beginning so I check for "#!" and rem out the first line if it exists, this maintains line numbers. http://wxlua.cvs.sourceforge.net/viewvc/wxlua/wxLua/samples/editor.wx.lua?r1=1.60&r2=1.61 Regards, John ------------------------------------------------------------------------------ Increase Visibility of Your 3D Game App & Earn a Chance To Win $500! Tap into the largest installed PC base & get more eyes on your game by optimizing for Intel(R) Graphics Technology. Get started today with the Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs. http://p.sf.net/sfu/intelisp-dev2dev _______________________________________________ wxlua-users mailing list wxlua-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wxlua-users