Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions wxLua/bindings/any-bind-sync.lua
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,9 @@ for interface, substeps in pairs(steps) do
local infile = false
local output = {}
local dups = {}
for line in io.lines(header) do
if not infile and line:find(process.from)
for ln in io.lines(header) do
local line = ln
if not infile and line:find(process.from)
or infile and line:find(process.to) then
infile = not infile
-- if the last line was "protected:", then remove it
Expand Down
8 changes: 4 additions & 4 deletions wxLua/bindings/genwxbind.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1463,8 +1463,8 @@ function ReadOverrideFile(override_file)
return
end

for line in io.lines(filename) do
line = line:gsub("%s+$","") -- drop all trailing whitespaces not handled by io.lines
for ln in io.lines(filename) do
local line = ln:gsub("%s+$","") -- drop all trailing whitespaces not handled by io.lines
local lineData = SplitString(line, delimiters)
local isOverride = false
local isEnd = false
Expand Down Expand Up @@ -1548,8 +1548,8 @@ function ReadInterfaceFile(filename)
local fileData = {}
local linenumber = 0

for line in io.lines(filename) do
line = line:gsub("%s+$","") -- drop all trailing whitespaces not handled by io.lines
for ln in io.lines(filename) do
local line = ln:gsub("%s+$","") -- drop all trailing whitespaces not handled by io.lines
linenumber = linenumber + 1

local lineTable =
Expand Down
3 changes: 2 additions & 1 deletion wxLua/bindings/stc-bind-sync.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ end
local function merge(defines, process, target)
local step = -1
local output = {}
for line in io.lines(sync) do
for ln in io.lines(sync) do
local line = ln
if step < 0 and -step <= #process and line:find(process[-step].from) then
step = -step
elseif step > 0 and line:find(process[step].to) then
Expand Down
5 changes: 5 additions & 0 deletions wxLua/modules/wxlua/wxlstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,13 @@ bool wxLuaState::Create(lua_State* L, int state_type)
// Make the GC a little more aggressive since we push void* data
// that may be quite large. The upshot is that Lua runs faster.
// Empirically found by timing: "for i = 1, 1E6 do local p = wx.wxPoint() end"
#if LUA_VERSION_NUM >= 505
lua_gc(L, LUA_GCPARAM, LUA_GCPPAUSE, 120);
lua_gc(L, LUA_GCPARAM, LUA_GCPSTEPMUL, 400);
#else
lua_gc(L, LUA_GCSETPAUSE, 120);
lua_gc(L, LUA_GCSETSTEPMUL, 400);
#endif

// Create a new state to push into Lua, the last wxLuaStateRefData will delete it.
// Note: we call SetRefData() so that we don't increase the ref count.
Expand Down
3 changes: 2 additions & 1 deletion wxLua/samples/editor.wx.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,8 @@ frame:Connect(ID_COMMENT, wx.wxEVT_COMMAND_MENU_SELECTED,
local lineNumber = editor:GetCurrentLine()
editor:SetSelection(editor:PositionFromLine(lineNumber), editor:GetLineEndPosition(lineNumber))
end
for line in string.gmatch(editor:GetSelectedText()..'\n', "(.-)\r?\n") do
for ln in string.gmatch(editor:GetSelectedText()..'\n', "(.-)\r?\n") do
local line = ln
if string.sub(line,1,2) == '--' then
line = string.sub(line,3)
else
Expand Down
7 changes: 4 additions & 3 deletions wxLua/samples/wxluasudoku.wx.lua
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,12 @@ function sudoku.Open(fileName)
local value_count = 0 -- number of cols in line
local row_count = 0 -- number of rows read
local line_n = 0 -- actual line number in file
for line in io.lines(fileName) do
for ln in io.lines(fileName) do
local line = ln
line_n = line_n + 1
local col_count = 0
for k, v in string.gmatch(line, "%d") do
k = tonumber(k)
for digit in string.gmatch(line, "%d") do
local k = tonumber(digit)
if (k >= 0) and (k <= 9) then
table.insert(values, k)
col_count = col_count + 1
Expand Down