<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://www.computercraft.info/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=ZudoHackz</id>
		<title>ComputerCraft Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://www.computercraft.info/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=ZudoHackz"/>
		<link rel="alternate" type="text/html" href="https://www.computercraft.info/wiki/Special:Contributions/ZudoHackz"/>
		<updated>2026-07-11T14:50:39Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.24.1</generator>

	<entry>
		<id>https://www.computercraft.info/wiki/index.php?title=Making_an_API_(tutorial)&amp;diff=6037</id>
		<title>Making an API (tutorial)</title>
		<link rel="alternate" type="text/html" href="https://www.computercraft.info/wiki/index.php?title=Making_an_API_(tutorial)&amp;diff=6037"/>
				<updated>2013-10-26T02:37:49Z</updated>
		
		<summary type="html">&lt;p&gt;ZudoHackz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Making an API ==&lt;br /&gt;
&lt;br /&gt;
An API is a program that is not directly executed, but is a collection of variables that can be accessed from any program on that computer.&lt;br /&gt;
&lt;br /&gt;
To make an API, you must create a new file. I will call it ''myapi''. Fill it with variable declarations as normal, but without the ''local'' keyword:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-- My awesome new API&lt;br /&gt;
&lt;br /&gt;
myvar = &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
function myCoolNewFunction()&lt;br /&gt;
    print(myvar)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now try it out. Save and exit the file, then open the ''lua'' program on your ingame computer. Then type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
os.loadAPI(&amp;quot;myapi&amp;quot;) -- replace myapi with the name of your API.&lt;br /&gt;
myapi.myCoolNewFunction()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have written the program correctly, you will see ''Hello World!'' printed to your screen. Now try:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
print(myapi.myvar)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should also see ''Hello World!'' printed to your screen. Congratulations, this is your first API!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Locals vs Globals ==&lt;br /&gt;
&lt;br /&gt;
OK, lets go back to our API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-- My awesome new API&lt;br /&gt;
&lt;br /&gt;
myvar = &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
function myCoolNewFunction()&lt;br /&gt;
    print(myvar)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we change our declaration for myvar to local, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-- My awesome new API&lt;br /&gt;
&lt;br /&gt;
local myvar = &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
function myCoolNewFunction()&lt;br /&gt;
    print(myvar)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we should get the same result if we call myCoolNewFunction(). '''REMEMBER: you will need to load the API again to apply your changes!'''&lt;br /&gt;
&lt;br /&gt;
But what happens if you try ''print(myapi.myvar)''?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It prints nothing. This is because we changed the declaration for myvar to local! This is useful if you want to have a variable visible to only your API. It will also work with functions, like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-- My awesome new API&lt;br /&gt;
&lt;br /&gt;
local myvar = &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
local function myCoolNewFunction()&lt;br /&gt;
    print(myvar)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now if you try to call myCoolNewFunction(), you will get an ''attempt to call nil'' error.&lt;br /&gt;
&lt;br /&gt;
[[Category:Tutorials]]&lt;/div&gt;</summary>
		<author><name>ZudoHackz</name></author>	</entry>

	<entry>
		<id>https://www.computercraft.info/wiki/index.php?title=Making_an_API_(tutorial)&amp;diff=6036</id>
		<title>Making an API (tutorial)</title>
		<link rel="alternate" type="text/html" href="https://www.computercraft.info/wiki/index.php?title=Making_an_API_(tutorial)&amp;diff=6036"/>
				<updated>2013-10-26T02:35:26Z</updated>
		
		<summary type="html">&lt;p&gt;ZudoHackz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Making an API ==&lt;br /&gt;
&lt;br /&gt;
An API is a program that is not directly executed, but is a collection of variables that can be accessed from any program on that computer.&lt;br /&gt;
&lt;br /&gt;
To make an API, you must create a new file. I will call it ''myapi''. Fill it with variable declarations as normal, but without the ''local'' keyword:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-- My awesome new API&lt;br /&gt;
&lt;br /&gt;
myvar = &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
function myCoolNewFunction()&lt;br /&gt;
    print(myvar)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now try it out. Save and exit the file, then open the ''lua'' program on your ingame computer. Then type:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
os.loadAPI(&amp;quot;myapi&amp;quot;) -- replace myapi with the name of your API.&lt;br /&gt;
myapi.myCoolNewFunction()&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you have written the program correctly, you will see ''Hello World!'' printed to your screen. Now try:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
print(myapi.myvar)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You should also see ''Hello World!'' printed to your screen. Congratulations, this is your first API!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Locals vs Globals ==&lt;br /&gt;
&lt;br /&gt;
OK, lets go back to our API.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-- My awesome new API&lt;br /&gt;
&lt;br /&gt;
myvar = &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
function myCoolNewFunction()&lt;br /&gt;
    print(myvar)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If we change our declaration for myvar to local, like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-- My awesome new API&lt;br /&gt;
&lt;br /&gt;
local myvar = &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
function myCoolNewFunction()&lt;br /&gt;
    print(myvar)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
we should get the same result if we call myCoolNewFunction(). '''REMEMBER: you will need to load the API again to apply your changes!'''&lt;br /&gt;
&lt;br /&gt;
But what happens if you try ''print(myapi.myvar)''?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It prints nothing. This is because we changed the declaration for myvar to local! This is useful if you want to have a variable visible to only your API. It will also work with functions, like this.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-- My awesome new API&lt;br /&gt;
&lt;br /&gt;
local myvar = &amp;quot;Hello World!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
local function myCoolNewFunction()&lt;br /&gt;
    print(myvar)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now if you try to call myCoolNewFunction(), you will get an ''attempt to call nil'' error.&lt;/div&gt;</summary>
		<author><name>ZudoHackz</name></author>	</entry>

	<entry>
		<id>https://www.computercraft.info/wiki/index.php?title=Os.startTimer&amp;diff=5978</id>
		<title>Os.startTimer</title>
		<link rel="alternate" type="text/html" href="https://www.computercraft.info/wiki/index.php?title=Os.startTimer&amp;diff=5978"/>
				<updated>2013-09-02T02:34:54Z</updated>
		
		<summary type="html">&lt;p&gt;ZudoHackz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{lowercase}}&lt;br /&gt;
{{Function&lt;br /&gt;
 |name=os.startTimer&lt;br /&gt;
 |args={{type|number}} time&lt;br /&gt;
 |api=OS&lt;br /&gt;
 |returns={{type|number}} timerID&lt;br /&gt;
 |addon=ComputerCraft&lt;br /&gt;
 |desc=Adds a timer which will fire a &amp;quot;timer&amp;quot; event once after &amp;lt;var&amp;gt;time&amp;lt;/var&amp;gt; seconds have passed. It returns an int which acts as a unique ID for the timer. Fractions of a second are supported, but only down to a game tick, or 1/20 of a second (0.05s). Times are rounded up to the next tick, so os.sleep(1.01) and os.sleep(1.05) both wait for 1.05 seconds.&lt;br /&gt;
 |examples=&lt;br /&gt;
{{Example&lt;br /&gt;
|desc=Yields until 3 seconds have passed&lt;br /&gt;
|code=os.startTimer(3)&amp;lt;br&amp;gt;os.pullEvent(timer)&lt;br /&gt;
}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Lua_Core_Functions]]&lt;/div&gt;</summary>
		<author><name>ZudoHackz</name></author>	</entry>

	<entry>
		<id>https://www.computercraft.info/wiki/index.php?title=Os.startTimer&amp;diff=5977</id>
		<title>Os.startTimer</title>
		<link rel="alternate" type="text/html" href="https://www.computercraft.info/wiki/index.php?title=Os.startTimer&amp;diff=5977"/>
				<updated>2013-09-02T02:34:34Z</updated>
		
		<summary type="html">&lt;p&gt;ZudoHackz: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{NeedsWork|This page needs an example}}&lt;br /&gt;
{{lowercase}}&lt;br /&gt;
{{Function&lt;br /&gt;
 |name=os.startTimer&lt;br /&gt;
 |args={{type|number}} time&lt;br /&gt;
 |api=OS&lt;br /&gt;
 |returns={{type|number}} timerID&lt;br /&gt;
 |addon=ComputerCraft&lt;br /&gt;
 |desc=Adds a timer which will fire a &amp;quot;timer&amp;quot; event once after &amp;lt;var&amp;gt;time&amp;lt;/var&amp;gt; seconds have passed. It returns an int which acts as a unique ID for the timer. Fractions of a second are supported, but only down to a game tick, or 1/20 of a second (0.05s). Times are rounded up to the next tick, so os.sleep(1.01) and os.sleep(1.05) both wait for 1.05 seconds.&lt;br /&gt;
 |examples=&lt;br /&gt;
{{Example&lt;br /&gt;
|desc=Yields until 3 seconds have passed&lt;br /&gt;
|code=os.startTimer(3)&amp;lt;br&amp;gt;os.pullEvent(timer)&lt;br /&gt;
}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Lua_Core_Functions]]&lt;/div&gt;</summary>
		<author><name>ZudoHackz</name></author>	</entry>

	</feed>