Skip to content

Commit

Permalink
Fix some issues
Browse files Browse the repository at this point in the history
  • Loading branch information
SquidDev committed Mar 8, 2016
1 parent d2d196f commit 3bb23b8
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
12 changes: 7 additions & 5 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ Most functionality of Lua 5.1 is implemented, with the following caveats:
- `debug.getinfo` only accepts a numeric value
- `.getmetatable`, `.setmetatable`, `.getfenv` and `.setfenv` are just their normal versions
- Everything else is not implemented
- `os` library is only partially implemented
- `os.setlocale` library is not implemented
- `io.popen` is not implemented.
- Several LuaJ bugs:
- `\011` is not considered whitespace
- `\011` is not considered whitespace\*
- `string.format` floating point specifiers don't work (e.g. `%5.2f`)
- `string.gmatch` will infinitely loop on the `*` pattern (e.g. `\n*`)
- `getmetatable` returns `nil` for strings.
- `string.gmatch` will infinitely loop on the `*` pattern (e.g. `\n*`)\*
- `getmetatable` returns the string library for strings.
- String's metatable and the `string` library are not the same, so you cannot add string methods.
- `%b` errors when no match is found.
- `%b` errors when no match is found.\*

\* *Fixed in CC 1.79pr2 or CCTweaks 0.3.1*

The LuaRocks implementation is very minimal:
- Currently only supports downloading GitHub repositories
Expand Down
1 change: 0 additions & 1 deletion bsrocks/commands/exec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ return {
return thisEnv.debug.traceback(msg, 2)
end
)
loaded(...)

for _, v in pairs(env.cleanup) do v() end

Expand Down
6 changes: 4 additions & 2 deletions bsrocks/downloaders/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ local downloaders = {
local url = source.url
if not url then return end

local repo = url:match("git://github%.com/(.*)")
local repo = url:match("git://github%.com/(.*)$")
local branch = source.branch or source.tag or "master"
if not repo then
if repo then
repo = repo:gsub("%.git$", "")
else
-- If we have the archive then we can also fetch from GitHub
repo, branch = url:match("https?://github%.com/(.*)/archive/(.*).tar.gz")
if not repo then return end
Expand Down
5 changes: 4 additions & 1 deletion bsrocks/env/fixes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ local function copy(tbl)
end

local function getmeta(obj)
if type(obj) == "table" then
local t = type(obj)
if t == "table" then
return getmetatable(obj)
elseif t == "string" then
return string
else
return nil
end
Expand Down
9 changes: 5 additions & 4 deletions bsrocks/env/io.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ local fileMeta = {

local data = {...}
local n = select("#", ...)
if n == 0 then n = 1 end
for i = 1, n do
local format = data[i]
format = checkType(format, "string"):gsub("*", "", true) -- "*" is not needed after Lua 5.1 - lets be friendly
local format = data[i] or "l"
format = checkType(format, "string"):gsub("%*", "") -- "*" is not needed after Lua 5.1 - lets be friendly
if format == "l" then
returns[#returns + 1] = handle.readLine()
elseif format == "a" then
Expand All @@ -59,7 +60,7 @@ local fileMeta = {
end
end

return unpack(data)
return unpack(returns)
end,

seek = function(self, ...)
Expand All @@ -85,7 +86,7 @@ local fileMeta = {
end,

lines = function(self, ...)
return function() return self.__handle.readLine() end
return self.__handle.readLine
end,
}
}
Expand Down

0 comments on commit 3bb23b8

Please sign in to comment.