Search found 35 matches
- Sun May 18, 2014 9:44 pm
- Forum: Support and Development
- Topic: Require in a thread fails
- Replies: 2
- Views: 1688
Re: Require in a thread fails
It's a long shot, but maybe try to require love.filesystem first.
- Thu May 15, 2014 5:32 pm
- Forum: Support and Development
- Topic: Lua version
- Replies: 4
- Views: 7908
Re: Lua version
At the moment LOVE is using LuaJIT 2.0.3 which corresponds to Lua 5.1. 'bit32' is Lua 5.2 specific I guess. You can use 'bit' instead, which is LuaJIT specific. How to check Lua version example: function luaInfo() local info = "Lua version: " .. _VERSION .. "\n" info = info .. &q...
- Tue May 13, 2014 6:57 pm
- Forum: Support and Development
- Topic: How to refer to a table inside another table?
- Replies: 14
- Views: 9591
Re: How to refer to a table inside another table?
In such a case, which is common, just add "stop" before the error message: "stop attempt to index local 'image' (a nil value)" Now you know what to do. Apply this schema to every error message you will get. Most programmers do that trick, it's faster than posting every error mess...
- Tue May 13, 2014 9:08 am
- Forum: Support and Development
- Topic: How to refer to a table inside another table?
- Replies: 14
- Views: 9591
Re: How to refer to a table inside another table?
Code: Select all
if stuff == not false then
print("blood boiling")
end
- Mon May 12, 2014 3:31 pm
- Forum: Support and Development
- Topic: Small Useful Functions
- Replies: 127
- Views: 53131
Re: Small extra functions
Anyway, I think that mixed solution is rather ugly. It doesn't overwrite conflicting number keys, but overwrites the rest of types? type(k) == "number" doesn't even mean that the key is an array index (e.g. 0, -1, 0.5 are not "valid" indexes that ipairs would respect). It would b...
- Mon May 12, 2014 2:27 pm
- Forum: Support and Development
- Topic: Small Useful Functions
- Replies: 127
- Views: 53131
Re: Small extra functions
You can use table.insert like in your first version:
Code: Select all
function mergetables(...)
local ret = {}
for i, tbl in ipairs {...} do
for k, v in pairs(tbl) do
if type(k) == "number" then
table.insert(ret, v)
else
ret[k] = v
end
end
end
return ret
end
- Sun May 11, 2014 10:28 pm
- Forum: Support and Development
- Topic: Small Useful Functions
- Replies: 127
- Views: 53131
Re: Small extra functions
Merge t1 and t2 into t1:
Code: Select all
function table.merge(t1, t2)
for k, v in pairs(t2) do
t1[k] = v
end
return t1
end
- Sun May 11, 2014 4:11 pm
- Forum: Support and Development
- Topic: Would a constantly updating 1024x grid lag?
- Replies: 7
- Views: 1670
Re: Would a constantly updating 1024x grid lag?
Store game objects in a separate table, and make grid fields refer to that table. Iterate and update only game objects table. For rendering, compute corners of the visible part of the grid, and render only that area, e.g.: local x0, y0, x1, y1 = computeVisibleArea() for y = y0, y1 do for x = x0, x1 ...
- Sat May 10, 2014 7:37 pm
- Forum: Support and Development
- Topic: protection, sharing and keeping your code?
- Replies: 14
- Views: 4587
Re: protection, sharing and keeping your code?
LuaJIT Extensions : The generated bytecode is portable and can be loaded on any architecture that LuaJIT supports, independent of word size or endianess. However the bytecode compatibility versions must match. Bytecode stays compatible for dot releases (x.y.0 → x.y.1), but may change with major or ...
- Sat May 10, 2014 7:01 pm
- Forum: Support and Development
- Topic: Console output in Sublime
- Replies: 1
- Views: 1342
Re: Console output in Sublime
Disabling console and adding io.stdout:setvbuf("no") to e.g. conf.lua (as shown here) does the trick. No console, but since Sublime receives output in real time, console would be redundant anyway in that case.