<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/Preprocessor?action=history&amp;feed=atom</id>
	<title>Preprocessor - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/Preprocessor?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Preprocessor&amp;action=history"/>
	<updated>2026-06-27T21:44:03Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=Preprocessor&amp;diff=60903&amp;oldid=prev</id>
		<title>CrosRoad95: Created page with &quot;{{Useful Function}} __NOTOC__ This function just adds a possibility to use GCC in mta. If you want use this clientside, user have to agree domain godbolt.org  ==Syntax== &lt;synt...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=Preprocessor&amp;diff=60903&amp;oldid=prev"/>
		<updated>2018-11-23T11:34:19Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;{{Useful Function}} __NOTOC__ This function just adds a possibility to use GCC in mta. If you want use this clientside, user have to agree domain godbolt.org  ==Syntax== &amp;lt;synt...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Useful Function}}&lt;br /&gt;
__NOTOC__&lt;br /&gt;
This function just adds a possibility to use GCC in mta. If you want use this clientside, user have to agree domain godbolt.org&lt;br /&gt;
&lt;br /&gt;
==Syntax==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;bool preprocess( string code, function theCallbackFunction )&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Required Arguments===&lt;br /&gt;
* '''code''': A code for preprocessing&lt;br /&gt;
* '''theCallbackFunction ''': The function who will recive&lt;br /&gt;
&lt;br /&gt;
===Returns===&lt;br /&gt;
True if both argument are valid&lt;br /&gt;
&lt;br /&gt;
==Code==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server- and/or clientside Script&amp;quot; class=&amp;quot;both&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function preprocess( code, cb )&lt;br /&gt;
  if( code and cb)then&lt;br /&gt;
    fetchRemote ( &amp;quot;https://godbolt.org/api/compiler/g82/compile?options=-E&amp;quot;,{postData = code, method = &amp;quot;POST&amp;quot;},&lt;br /&gt;
    function( responseData, errno )&lt;br /&gt;
      local splt = split(responseData,&amp;quot;\n&amp;quot;)&lt;br /&gt;
      cb(table.concat(splt,&amp;quot;\r\n&amp;quot;, 2, #splt))&lt;br /&gt;
    end)&lt;br /&gt;
  end&lt;br /&gt;
  return true&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
&amp;lt;section name=&amp;quot;Server&amp;quot; class=&amp;quot;server&amp;quot; show=&amp;quot;true&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
function callbackFunction(code)&lt;br /&gt;
  loadstring(code)()&lt;br /&gt;
end&lt;br /&gt;
preprocess([[&lt;br /&gt;
#define a 1&lt;br /&gt;
#define b 2&lt;br /&gt;
#define ADD(x,y) x+y&lt;br /&gt;
#define c a+b&lt;br /&gt;
print(a+b) -- print(1+2)&lt;br /&gt;
print(ADD(1,2)) -- print(1+2)&lt;br /&gt;
print(c) -- print(1+2)&lt;br /&gt;
]], callbackFunction)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&amp;lt;/section&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Author: CrosRoad95&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
{{Useful_Functions}}&lt;/div&gt;</summary>
		<author><name>CrosRoad95</name></author>
	</entry>
</feed>