From: John L. <jla...@gm...> - 2010-11-24 19:14:52
|
On Wed, Nov 24, 2010 at 1:57 PM, Andre Arpin <ar...@ki...> wrote: > SourceForge.net <noreply@...> 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 |