- ComputerCraft | Programmable Computers for Minecraft
- → HometownPotato's Content
HometownPotato's Content
There have been 58 items by HometownPotato (Search limited from 10-February 22)
#203576 Gravity Manipulation Questions
Posted by
HometownPotato
on 19 January 2015 - 08:36 AM
in
Ask a Pro
But whenever you want to use it you have take note that the y axis increases as you go down, meaning 45 degree rotation would actually be -45 degrees.
#203515 API Dump?
Posted by
HometownPotato
on 18 January 2015 - 05:30 PM
in
Ask a Pro
Of course I would have to do a deep scan but thanks
#203495 API Dump?
Posted by
HometownPotato
on 18 January 2015 - 11:27 AM
in
Ask a Pro
#203493 API Dump?
Posted by
HometownPotato
on 18 January 2015 - 11:14 AM
in
Ask a Pro
I ask this so I can create a parse it into a small and compact couple of HTML files that should work with all versions of CC (assuming a function like this exists and existed). I don't really want to go manually over the wiki since it might change in the future without me knowing.
#203492 Some kind of "sandbox" for your scripts
Posted by
HometownPotato
on 18 January 2015 - 11:08 AM
in
APIs and Utilities
It's really as simple as: getfenv(2).shell.run("prog");
You should block getfenv and loadstring and other functions people shouldn't need.
But setmetatable and getmetatable should stay enabled since there is no point in disabling it and iTable/getFunc should not be local since the sandboxed code will be able to access them if they are local.
#177608 Printer.write too long for the page!
Posted by
HometownPotato
on 08 May 2014 - 11:47 PM
in
Ask a Pro
So something like:
local text = "blah"; local sX, sY = printer.getPageSize(); local lines = math.ceil(#text / sX) for y = 1, lines do local start = ((y - 1) * sX) + 1; local finish = y * sX; printer.setCursorPos(1, y) printer.write(text:sub(start, finish)); endThe math seemed to have worked out in my head, though I'm not sure it's entirely correct.
Also, you can implement something fairly easy (when lines > paper size Y) to check if it reached the end of the page, then start a new page.
#177200 [Question]
Posted by
HometownPotato
on 07 May 2014 - 01:11 AM
in
Ask a Pro
os.pullEvent = os.pullEventRaw;
So you set os.pullEvent to the os.pullEventRaw function, since calling it only returns what the function returns which will give you problems and not what you want.
#177170 Help with my ticket machine?
Posted by
HometownPotato
on 06 May 2014 - 11:25 PM
in
Ask a Pro
#177164 Help with my ticket machine?
Posted by
HometownPotato
on 06 May 2014 - 11:03 PM
in
Ask a Pro
And you can do a basic, secure encryption as long as you know no one will access that computer (with the scan and eject) since you are using a monitor.
#177161 [help]wireless peripheral api
Posted by
HometownPotato
on 06 May 2014 - 11:01 PM
in
Ask a Pro
Yeah, I meant change sorry.
#176852 Restart a count after reaching a certain value?
Posted by
HometownPotato
on 05 May 2014 - 03:57 AM
in
Ask a Pro
#176824 Door lock redstone output question
Posted by
HometownPotato
on 04 May 2014 - 11:03 PM
in
Ask a Pro
And if so, are you sure nothing is changing its output other than the computer?
#176821 Memory
Posted by
HometownPotato
on 04 May 2014 - 10:55 PM
in
Ask a Pro
#176797 Setfenv
Posted by
HometownPotato
on 04 May 2014 - 08:57 PM
in
Ask a Pro
#176789 Setfenv
Posted by
HometownPotato
on 04 May 2014 - 08:36 PM
in
Ask a Pro
And you do use metatables as well for sandboxing.
#176763 Restart a count after reaching a certain value?
Posted by
HometownPotato
on 04 May 2014 - 06:39 PM
in
Ask a Pro
I just know from testing that it was about that number.
#176723 not (yet) real object oriented stuff
Posted by
HometownPotato
on 04 May 2014 - 05:21 PM
in
Ask a Pro
Also try looking at http://pastebin.com/t0Nb6pbS, it might help you understand OOP in Lua a bit
#176722 Restart a count after reaching a certain value?
Posted by
HometownPotato
on 04 May 2014 - 05:19 PM
in
Ask a Pro
#176721 Setfenv
Posted by
HometownPotato
on 04 May 2014 - 05:18 PM
in
Ask a Pro
local oldEnv = getfenv();
setfenv(1, setmetatable({}, {__index = oldEnv; __newindex = function(self, key, value) rawset(self, key, {value}) end;}));
#176564 Restart a count after reaching a certain value?
Posted by
HometownPotato
on 04 May 2014 - 04:13 AM
in
Ask a Pro
local counter = (i % 8) + 1;
--code
end
#176561 Verifying that two files are the same
Posted by
HometownPotato
on 04 May 2014 - 03:53 AM
in
Ask a Pro
local x = fs.open("file1");
local c = x.readAll();
x.close();
x = fs.open("file2");
local c2 = x.readAll();
x.close();
if c == c2 then
end
It would check if the contents are the same
#176559 more printers on one computer?
Posted by
HometownPotato
on 04 May 2014 - 03:51 AM
in
Ask a Pro
#176412 Restart a count after reaching a certain value?
Posted by
HometownPotato
on 03 May 2014 - 05:44 AM
in
Ask a Pro
while true do
globalCount = globalCount + 1
if globalCount == 8 then
globalCount = 0
print("Done")
end
sleep(0)
end
#176229 Check if variable exists and edit problems
Posted by
HometownPotato
on 02 May 2014 - 05:10 AM
in
Ask a Pro
#176222 Check if variable exists and edit problems
Posted by
HometownPotato
on 02 May 2014 - 02:54 AM
in
Ask a Pro
- ComputerCraft | Programmable Computers for Minecraft
- → HometownPotato's Content


