mirror of
				https://github.com/SquidDev-CC/CC-Tweaked
				synced 2025-11-04 07:32:59 +00:00 
			
		
		
		
	Merge pull request #566 from SquidDev-CC/ComputerCraft/feature/tiny-lua-wins
A couple of small improvements to CraftOS
This commit is contained in:
		@@ -18,9 +18,6 @@ if _VERSION == "Lua 5.1" then
 | 
			
		||||
        if env ~= nil and type( env) ~= "table" then
 | 
			
		||||
            error( "bad argument #4 (expected table, got " .. type( env ) .. ")", 2 ) 
 | 
			
		||||
        end
 | 
			
		||||
        if mode ~= nil and mode ~= "t" then
 | 
			
		||||
            error( "Binary chunk loading prohibited", 2 )
 | 
			
		||||
        end
 | 
			
		||||
        local ok, p1, p2 = pcall( function()        
 | 
			
		||||
            if type(x) == "string" then
 | 
			
		||||
                local result, err = nativeloadstring( x, name )
 | 
			
		||||
 
 | 
			
		||||
@@ -421,8 +421,10 @@ function create( parent, nX, nY, nWidth, nHeight, bStartVisible )
 | 
			
		||||
    function window.reposition( nNewX, nNewY, nNewWidth, nNewHeight )
 | 
			
		||||
        if type( nNewX ) ~= "number" then error( "bad argument #1 (expected number, got " .. type( nNewX ) .. ")", 2 ) end
 | 
			
		||||
        if type( nNewY ) ~= "number" then error( "bad argument #2 (expected number, got " .. type( nNewY ) .. ")", 2 ) end
 | 
			
		||||
        if nNewWidth ~= nil and type( nNewWidth ) ~= "number" then error( "bad argument #3 (expected number, got " .. type( nNewWidth ) .. ")", 2 ) end
 | 
			
		||||
        if nNewHeight ~= nil and type( nNewHeight ) ~= "number" then error( "bad argument #4 (expected number, got " .. type( nNewHeight ) .. ")", 2 ) end
 | 
			
		||||
        if nNewWidth ~= nil or nNewWidth ~= nil  then
 | 
			
		||||
            if type( nNewWidth ) ~= "number" then error( "bad argument #3 (expected number, got " .. type( nNewWidth ) .. ")", 2 ) end
 | 
			
		||||
            if type( nNewHeight ) ~= "number" then error( "bad argument #4 (expected number, got " .. type( nNewHeight ) .. ")", 2 ) end
 | 
			
		||||
        end
 | 
			
		||||
 | 
			
		||||
        nX = nNewX
 | 
			
		||||
        nY = nNewY
 | 
			
		||||
 
 | 
			
		||||
@@ -13,18 +13,14 @@ if sTopic == "index" then
 | 
			
		||||
    return
 | 
			
		||||
end
 | 
			
		||||
    
 | 
			
		||||
local w,h = term.getSize()
 | 
			
		||||
local sFile = help.lookup( sTopic )
 | 
			
		||||
local file = ((sFile ~= nil) and io.open( sFile )) or nil
 | 
			
		||||
local nLinesPrinted = 0
 | 
			
		||||
if file then
 | 
			
		||||
    local sLine = file:read()
 | 
			
		||||
    local nLines = 0
 | 
			
		||||
    while sLine do
 | 
			
		||||
        nLines = nLines + textutils.pagedPrint( sLine, (h-3) - nLines )
 | 
			
		||||
        sLine = file:read()
 | 
			
		||||
    end
 | 
			
		||||
    local sContents = file:read("*a")
 | 
			
		||||
    file:close()
 | 
			
		||||
 | 
			
		||||
    local _, nHeight = term.getSize()
 | 
			
		||||
    textutils.pagedPrint( sContents, nHeight - 3 )
 | 
			
		||||
else
 | 
			
		||||
    print( "No help available" )
 | 
			
		||||
end
 | 
			
		||||
 
 | 
			
		||||
@@ -113,7 +113,7 @@ elseif sCommand == "run" then
 | 
			
		||||
            printError( err )
 | 
			
		||||
            return
 | 
			
		||||
        end
 | 
			
		||||
        local success, msg = pcall(func, table.unpack(tArgs, 3))
 | 
			
		||||
        local success, msg = pcall(func, select(3, ...))
 | 
			
		||||
        if not success then
 | 
			
		||||
            printError( msg )
 | 
			
		||||
        end
 | 
			
		||||
 
 | 
			
		||||
@@ -89,18 +89,17 @@ end
 | 
			
		||||
 | 
			
		||||
print( "Press any key to stop the groove" )
 | 
			
		||||
 | 
			
		||||
local bEnd = false
 | 
			
		||||
parallel.waitForAll(
 | 
			
		||||
parallel.waitForAny(
 | 
			
		||||
    function()
 | 
			
		||||
        while not bEnd do
 | 
			
		||||
            local event, key = os.pullEvent("key")
 | 
			
		||||
            if key ~= keys.escape then
 | 
			
		||||
                bEnd = true
 | 
			
		||||
                return
 | 
			
		||||
            end
 | 
			
		||||
        end        
 | 
			
		||||
    end,
 | 
			
		||||
    function()
 | 
			
		||||
        while not bEnd do
 | 
			
		||||
        while true do
 | 
			
		||||
            local fnMove = tMoves[math.random(1,#tMoves)]
 | 
			
		||||
            fnMove()
 | 
			
		||||
        end
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user