Skip to content

Commit

Permalink
Use CCTweaks' profiler if possible
Browse files Browse the repository at this point in the history
 - Also remove some getfenv usage
  • Loading branch information
SquidDev committed Oct 18, 2016
1 parent 4f75ae0 commit bf2b162
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 7 deletions.
16 changes: 13 additions & 3 deletions Howlfile.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,20 @@ end):description "Destory unlicensed files"
Tasks:Task "build" {"clean", "licenses", "replMin", "cleanup"} :description "Main build task"
Tasks:Default "build"

Tasks:gist "upload" (function(spec)
Tasks:Task "upload" {"upload:core", "upload:repl"} :description "Uploads all the files"

Tasks:gist "upload:core" (function(spec)
spec:summary "Vanilla Lua emulation and package manager (http://www.computercraft.info/forums2/index.php?/topic/26032- and https://github.com/SquidDev-CC/Blue-Shiny-Rokcs)"
spec:gist "6ced21eb437a776444aacef4d597c0f7"
spec:from "build" {
include = { "bsrocks.lua", "bsrocks.min.lua", "repl.lua", "repl.min.lua" }
include = { "bsrocks.lua", "bsrocks.min.lua" }
}
end) :Requires { "build/bsrocks.lua", "build/bsrocks.min.lua" }

Tasks:gist "upload:repl" (function(spec)
spec:summary "A fancy Lua REPL (originally from Blue-Shiny-Rocks: http://www.computercraft.info/forums2/index.php?/topic/26032- and https://github.com/SquidDev-CC/Blue-Shiny-Rokcs)"
spec:gist "e204ea9b6032dabf0cba3f57893125ba"
spec:from "build" {
include = { "repl.lua", "repl.min.lua" }
}
end) :Requires { "build/bsrocks.lua", "build/bsrocks.min.lua", "build/repl.lua", "build/repl.min.lua" }
end) :Requires { "build/repl.lua", "build/repl.min.lua" }
6 changes: 3 additions & 3 deletions bsrocks/env/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ return function()
_VERSION = _VERSION
}
_G._G = _G
_G._ENV = _ENV
_G._ENV = _G

local env = {
_G = _G,
Expand Down Expand Up @@ -163,8 +163,8 @@ return function()
require "bsrocks.env.package"(env)

-- Copy functions across
addWithMeta(getfenv(), _G)
_G._NATIVE = getfenv()
addWithMeta(_ENV, _G)
_G._NATIVE = _ENV

return env
end
8 changes: 7 additions & 1 deletion bsrocks/env/os.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ local checkType = utils.checkType
return function(env)
local os, shell = os, shell
local temp = {}

local clock = os.clock
if profiler and profiler.milliTime then
clock = function() return profiler.milliTime() * 1e-3 end
end

env._G.os = {
clock = os.clock,
clock = clock,
date = function(format, time)
format = checkType(format or "%c", "string")
time = checkType(time or os.time(), "number")
Expand Down

0 comments on commit bf2b162

Please sign in to comment.