<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Maratis forum - Access to files outside the games .npk]]></title>
	<link rel="self" href="http://forum.maratis3d.com/extern.php?action=feed&amp;tid=662&amp;type=atom"/>
	<updated>2013-05-11T08:57:04Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.maratis3d.com/viewtopic.php?id=662</id>
		<entry>
			<title type="html"><![CDATA[Re: Access to files outside the games .npk]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=4133#p4133"/>
			<content type="html"><![CDATA[<p>I&#039;ll try to add a function to get the game directory from script.</p>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2013-05-11T08:57:04Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=4133#p4133</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Access to files outside the games .npk]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=4132#p4132"/>
			<content type="html"><![CDATA[<p>==&gt; -- NB: The text file must be located in the same directory as binaries, ie :<br />That would explain why it couldn&#039;t find the file <img src="http://forum.maratis3d.com/img/smilies/wink.png" width="15" height="15" alt="wink" /></p><p>Thanks for your advice <img src="http://forum.maratis3d.com/img/smilies/big_smile.png" width="15" height="15" alt="big_smile" /></p><p>Sponk</p>]]></content>
			<author>
				<name><![CDATA[Sponk]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1316</uri>
			</author>
			<updated>2013-05-11T08:30:22Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=4132#p4132</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Access to files outside the games .npk]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=4129#p4129"/>
			<content type="html"><![CDATA[<p>Here is a complete example with a few tips on file locations:</p><p>function settingsFromFile()</p><p>-- NB: The text file must be located in the same directory as binaries, ie :<br />-- &nbsp; &nbsp; &nbsp; &nbsp; &quot;/Maratis/Bin&quot; for unpublished projects<br />--&nbsp; &nbsp; &nbsp; &nbsp; &quot;/MyProject/published&quot; for published projects</p><p>&nbsp; &nbsp; file = io.open(&quot;Settings.txt&quot;, &quot;r&quot;) -- open file in read (&quot;r&quot;) mode</p><p>&nbsp; &nbsp; if file then -- catch IO errors</p><p>&nbsp; &nbsp; &nbsp; &nbsp; settings = {} -- create an array containing all file&#039;s lines (each one is a parameter)<br />&nbsp; &nbsp; &nbsp; &nbsp; for line in file:lines() do table.insert(settings, line) end</p><p>&nbsp; &nbsp; &nbsp; &nbsp; -- Set parameters<br />&nbsp; &nbsp; &nbsp; &nbsp; force = settings[1]</p><p>&nbsp; &nbsp; &nbsp; &nbsp; file:close() -- close file</p><p>&nbsp; &nbsp; end</p><p>end</p><p>settingsFromFile()</p><p>-- scene update<br />if onKeyDown(&quot;B&quot;) then addCentralForce(Player, {0, 0, force}, &quot;local&quot;) end</p>]]></content>
			<author>
				<name><![CDATA[com3D]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1488</uri>
			</author>
			<updated>2013-05-10T11:36:24Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=4129#p4129</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Access to files outside the games .npk]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=4128#p4128"/>
			<content type="html"><![CDATA[<p>I guess you can use &quot;file = io.open(filename, &quot;r&quot;)&quot; to read a file,<br />as for the path I&#039;m not sure as I never tested it, it&#039;s a standard lua library that handle it and not Maratis.</p>]]></content>
			<author>
				<name><![CDATA[anael]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=2</uri>
			</author>
			<updated>2013-05-10T09:27:48Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=4128#p4128</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Access to files outside the games .npk]]></title>
			<link rel="alternate" href="http://forum.maratis3d.com/viewtopic.php?pid=4127#p4127"/>
			<content type="html"><![CDATA[<p>Hello community,</p><p>I want to read a configuration file from outside the npk via lua into my game.</p><p>First: Is that possible?<br />Second: How do have to do that?</p><p>Sponk</p>]]></content>
			<author>
				<name><![CDATA[Sponk]]></name>
				<uri>http://forum.maratis3d.com/profile.php?id=1316</uri>
			</author>
			<updated>2013-05-09T16:10:53Z</updated>
			<id>http://forum.maratis3d.com/viewtopic.php?pid=4127#p4127</id>
		</entry>
</feed>
