> t = fs
> file = t.open("/rom/apis/peripheral", "r")
> file.readAll()
Passwords retrieved.
Easy
You should override the fs api if you want to secure files.
There have been 177 items by MysticT (Search limited from 10-February 22)
Posted by
MysticT
on 09 August 2013 - 03:33 PM
in
Ask a Pro
content = http.get("http://smp.projectbuilder.info/fetch.php?cmd=page&ID=dialgate&buffer=0&name=" .. textutils.urlEncode(destination))
Posted by
MysticT
on 09 August 2013 - 12:08 PM
in
Peripherals and Turtle Upgrades
wrothmonk, on 09 August 2013 - 08:40 AM, said:
# Configuration file
####################
# block
####################
block {
I:peripherals.block.id=3414
I:peripherals.lan-wire.id=464
}
####################
# general
####################
general {
B:autoAssign=false
B:enableTPSCommand=true
#
S:peripherals.adminPassword=
B:peripherals.enableAdventureMapInterface=true
B:peripherals.enableCraftingAcceleratorComponents=true
B:peripherals.enableCraftingCryptoAccelerator=true
B:peripherals.enableCraftingLANModem=true
B:peripherals.enableCraftingLANWire=true
B:peripherals.enableCraftingMagCardDevice=true
B:peripherals.enableCraftingMagCards=true
B:peripherals.enableCraftingRFIDCards=true
B:peripherals.enableCraftingRFIDReader=true
B:peripherals.enableCraftingRFIDWriter=true
B:peripherals.enableCraftingSpeaker=true
B:peripherals.enableLAN=true
B:peripherals.enableLANSenderSpoofing=true
I:peripherals.rfidTicksPerScan=10
}
####################
# item
####################
item {
I:peripherals.component=28230
I:peripherals.magstripe=10153
I:peripherals.rfid=16230
}
local p = peripheral.wrap("right")
local player = p.getPlayerByName(username)
if player then
print("Player Health: ", player.getHealth())
end
Posted by
MysticT
on 08 August 2013 - 09:07 PM
in
Suggestions
Posted by
MysticT
on 08 August 2013 - 02:52 PM
in
Ask a Pro
Posted by
MysticT
on 05 August 2013 - 06:19 PM
in
Ask a Pro
Posted by
MysticT
on 05 August 2013 - 02:40 PM
in
Ask a Pro
Posted by
MysticT
on 05 August 2013 - 11:17 AM
in
Ask a Pro
local clockTimer = os.startTimer(1) -- start a timer for 1 second
-- Main loop
while true do
local evt, p1, p2, p3, p4, p5 = os.pullEvent()
if evt == "timer" then
if p1 == clockTimer then
displayTime() -- redraw the clock
clockTimer = os.startTimer(1) -- restart the timer
end
elseif evt == "some other event" then
-- handle the event
end
end
Posted by
MysticT
on 23 July 2013 - 09:10 PM
in
Ask a Pro
local function drawBox(x, y, w, h, color)
local line = string.rep(" ", w)
term.setBackgroundColor(color)
for i = 0, h-1 do
term.setCursorPos(x, y + i)
term.write(line)
end
end
That way you draw a full line instead of only one character.
Posted by
MysticT
on 17 July 2013 - 12:10 PM
in
Ask a Pro
Yuri, on 17 July 2013 - 11:51 AM, said:
ex = {
a = 1,
A = 10,
}
print(ex[a])
print(ex["a"])wich is the same as:
print(ex.a)
Yuri, on 17 July 2013 - 11:51 AM, said:
Quote
local function getTableSize(t) local size = 0 for k,v in pairs(t) do size = size + 1 end return size end
Posted by
MysticT
on 16 July 2013 - 09:43 AM
in
Programs
reububble, on 16 July 2013 - 03:03 AM, said:
side="right" -- if the main computer is on the right
while true do
os.pullEvent("redstone")
if rs.getInput(side) then
parallel.waitForAny(
function()
while true do
peripheral.call(side,turnOn)
os.queueEvent('blah') os.pullEvent('blah') -- to yield
end
end,
function()
while true do
os.pullEvent("redstone")
if rs.getInput(side) then
break
end
end
end)
end
end
end
if ev=="key" then if p1=29 then rs.setOutput(side,true) sleep(0.05) rs.setOutput(side,false) -- remember that 'side' needs to be the side the other computer is on else rs.setOutput(side,true) sleep(0.05) rs.setOutput(side,false) end end
Posted by
MysticT
on 15 July 2013 - 04:44 PM
in
Programs
reububble, on 15 July 2013 - 04:21 PM, said:
rhyleymaster, on 15 July 2013 - 01:43 PM, said:
Posted by
MysticT
on 13 July 2013 - 09:27 PM
in
Ask a Pro
local but = {
n = 1, -- shared n, initialized to 1
a = function (self)
self.n = 2 -- self is the passed argument, not the "but" table
end,
b = function (self)
self.n = 1
end
}
local but1 = setmetatable({}, {__index = but})
local but2 = setmetatable({}, {__index = but})
print(but1.n) -- both this "n" references are to the shared value
print(but2.n)
but1:a() -- this would call but.a(but1)
print(but1.n) -- but1.n was set before, so it takes that value
print(but2.n) -- but2.n is not defined, so it uses but.n (the shared value)
Posted by
MysticT
on 13 July 2013 - 06:31 PM
in
Ask a Pro
local someTable = {
key1 = "Hello World!",
key2 = 2
}
local tbl = {
key2 = 10,
key3 = "Some Random String"
}
setmetatable(tbl, { __index = someTable })
print(tbl.key1) -- this will print "Hello World!", from someTable, because the key is not in tbl
print(tbl.key2) -- this will print 10, as the key is present in tbl
print(tbl.key3) -- this will print "Some Random String"
local Class = {}
function Class:doSomething()
print("Test")
end
function Class:test()
print(self.value)
end
local obj = setmetatable({}, { __index = Class })
obj.value = 10 -- set value in the instance object
obj:doSomething()
obj:test() -- this should print 10, the value we just assigned to obj.value
Posted by
MysticT
on 09 July 2013 - 07:59 PM
in
Ask a Pro
local input = read()
local func = loadstring("return "..input)
if func then
setfenv(func, {})
local ok, result = pcall(func)
if ok then
print(result)
else
printError("Error: ", result)
end
else
printError("Invalid input")
end
Posted by
MysticT
on 08 July 2013 - 07:28 PM
in
Ask a Pro
local nativesetmetatable = setmetatable
function setmetatable( _o, _t )
if _t and type(_t) == "table" then
local idx = rawget( _t, "__index" )
if idx and type( idx ) == "table" then
rawset( _t, "__index", function( t, k ) return idx[k] end )
end
local newidx = rawget( _t, "__newindex" )
if newidx and type( newidx ) == "table" then
rawset( _t, "__newindex", function( t, k, v ) newidx[k] = v end )
end
end
return nativesetmetatable( _o, _t )
end
I don't know why this is done, but there must be a reason why they added it.
Posted by
MysticT
on 07 July 2013 - 06:04 PM
in
Forum Games
Posted by
MysticT
on 07 July 2013 - 06:03 PM
in
Ask a Pro
local rnd = math.random(100, 500)
local apass = tostring((rnd + 11) * 83)
local ovrpass = read()
if ovrpass == apass then
print("Override Success...")
else
print("Override Failure...")
end
Posted by
MysticT
on 05 July 2013 - 08:43 PM
in
Forum Games
