Browse Source

Did the Lua types for ElementForm and ElementFormControl

fixed the precompiled header

Added the things that are exposed in the .lib to the /Include directory

Moved things around to get rid of compile errors
Nate Starkey 13 years ago
parent
commit
e67cc58893

+ 412 - 380
Build/RocketLua.vcproj

@@ -1,382 +1,414 @@
 <?xml version="1.0" encoding="Windows-1252"?>
 <VisualStudioProject
-ProjectType="Visual C++"
-Version="9.00"
-Name="RocketLua"
-ProjectGUID="{FC02901C-3CE4-4625-856A-F180DC45A855}"
-RootNamespace="RocketLua"
-TargetFrameworkVersion="196613"
->
-<Platforms>
-<Platform
-Name="Win32"
-/>
-</Platforms>
-<ToolFiles>
-</ToolFiles>
-<Configurations>
-<Configuration
-Name="Debug|Win32"
-OutputDirectory="$(IntDir)"
-IntermediateDirectory="build\$(ProjectName)\$(ConfigurationName)"
-ConfigurationType="2"
-CharacterSet="2"
-DeleteExtensionsOnClean="*.obj;*.ilk;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.pgc;*.pgd;*.meta;$(TargetPath)"
->
-<Tool
-Name="VCPreBuildEventTool"
-/>
-<Tool
-Name="VCCustomBuildTool"
-/>
-<Tool
-Name="VCXMLDataGeneratorTool"
-/>
-<Tool
-Name="VCWebServiceProxyGeneratorTool"
-/>
-<Tool
-Name="VCMIDLTool"
-/>
-<Tool
-Name="VCCLCompilerTool"
-Optimization="0"
-AdditionalIncludeDirectories="$(SolutionDir)..\Include;$(SolutionDir)..\Source\Core;$(SolutionDir)..\Dependencies\lua\src;"
-PreprocessorDefinitions="_WIN32,_DEBUG,RocketLua_EXPORTS"
-MinimalRebuild="true"
-BasicRuntimeChecks="3"
-RuntimeLibrary="3"
-UsePrecompiledHeader="1"
-PrecompiledHeaderThrough="precompiled.h"
-WarningLevel="3"
-DebugInformationFormat="4"
-/>
-<Tool
-Name="VCManagedResourceCompilerTool"
-/>
-<Tool
-Name="VCResourceCompilerTool"
-/>
-<Tool
-Name="VCPreLinkEventTool"
-/>
-<Tool
-Name="VCLinkerTool"
-LinkLibraryDependencies="false"
-AdditionalDependencies="lua51.lib RocketCore_d.lib"
-ShowProgress="0"
-OutputFile="..\bin\$(ProjectName)_d.dll"
-AdditionalLibraryDirectories="$(SolutionDir)..\bin"
-GenerateManifest="false"
-EnableUAC="false"
-GenerateDebugInformation="true"
-ImportLibrary="$(TargetDir)$(TargetName).lib"
-TargetMachine="1"
-/>
-<Tool
-Name="VCALinkTool"
-/>
-<Tool
-Name="VCManifestTool"
-/>
-<Tool
-Name="VCXDCMakeTool"
-/>
-<Tool
-Name="VCBscMakeTool"
-/>
-<Tool
-Name="VCFxCopTool"
-/>
-<Tool
-Name="VCAppVerifierTool"
-/>
-<Tool
-Name="VCPostBuildEventTool"
-/>
-</Configuration>
-<Configuration
-Name="Release|Win32"
-OutputDirectory="$(IntDir)"
-IntermediateDirectory="build\$(ProjectName)\$(ConfigurationName)"
-ConfigurationType="2"
-CharacterSet="2"
-WholeProgramOptimization="1"
->
-<Tool
-Name="VCPreBuildEventTool"
-/>
-<Tool
-Name="VCCustomBuildTool"
-/>
-<Tool
-Name="VCXMLDataGeneratorTool"
-/>
-<Tool
-Name="VCWebServiceProxyGeneratorTool"
-/>
-<Tool
-Name="VCMIDLTool"
-/>
-<Tool
-Name="VCCLCompilerTool"
-Optimization="2"
-EnableIntrinsicFunctions="true"
-AdditionalIncludeDirectories="$(SolutionDir)..\Include;$(SolutionDir)..\Source\Core;$(SolutionDir)..\Dependencies\lua\src;"
-PreprocessorDefinitions="_WIN32,NDEBUG,RocketLua_EXPORTS"
-RuntimeLibrary="2"
-EnableFunctionLevelLinking="true"
-UsePrecompiledHeader="1"
-PrecompiledHeaderThrough="precompiled.h"
-WarningLevel="3"
-DebugInformationFormat="3"
-/>
-<Tool
-Name="VCManagedResourceCompilerTool"
-/>
-<Tool
-Name="VCResourceCompilerTool"
-/>
-<Tool
-Name="VCPreLinkEventTool"
-/>
-<Tool
-Name="VCLinkerTool"
-AdditionalDependencies="lua51.lib;RocketCore.lib"
-OutputFile="..\bin\$(ProjectName).dll"
-GenerateManifest="false"
-GenerateDebugInformation="false"
-OptimizeReferences="2"
-EnableCOMDATFolding="2"
-ImportLibrary="$(TargetDir)$(TargetName).lib"
-TargetMachine="1"
-/>
-<Tool
-Name="VCALinkTool"
-/>
-<Tool
-Name="VCManifestTool"
-/>
-<Tool
-Name="VCXDCMakeTool"
-/>
-<Tool
-Name="VCBscMakeTool"
-/>
-<Tool
-Name="VCFxCopTool"
-/>
-<Tool
-Name="VCAppVerifierTool"
-/>
-<Tool
-Name="VCPostBuildEventTool"
-/>
-</Configuration>
-</Configurations>
-<References>
-</References>
-<Files>
-<Filter
-Name="Element"
->
-<File
-RelativePath="..\Source\Core\Lua\Element.cpp"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\Element.h"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\ElementStyle.cpp"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\ElementStyle.h"
->
-</File>
-<Filter
-Name="Document"
->
-<File
-RelativePath="..\Source\Core\Lua\Document.cpp"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\Document.h"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\LuaDocument.cpp"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\LuaDocument.h"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\LuaDocumentElementInstancer.cpp"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\LuaDocumentElementInstancer.h"
->
-</File>
-</Filter>
-</Filter>
-<Filter
-Name="Core"
->
-<File
-RelativePath="..\Source\Core\Lua\Context.cpp"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\Context.h"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\Interpreter.cpp"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\Interpreter.h"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\Log.cpp"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\Log.h"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\lua.hpp"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\LuaType.h"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\LuaType.inl"
->
-<FileConfiguration
-Name="Debug|Win32"
->
-<Tool
-Name="VCCustomBuildTool"
-/>
-</FileConfiguration>
-<FileConfiguration
-Name="Release|Win32"
-ExcludedFromBuild="true"
->
-<Tool
-Name="VCCLCompilerTool"
-/>
-</FileConfiguration>
-</File>
-<File
-RelativePath="..\Source\Core\Lua\Register.h"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\Rocket.cpp"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\Rocket.h"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\RocketLua.cpp"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\RocketLua.h"
->
-</File>
-</Filter>
-<Filter
-Name="Basic Types"
->
-<File
-RelativePath="..\Source\Core\Lua\Colourb.cpp"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\Colourb.h"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\Colourf.cpp"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\Colourf.h"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\Vector2f.cpp"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\Vector2f.h"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\Vector2i.cpp"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\Vector2i.h"
->
-</File>
-</Filter>
-<Filter
-Name="Event"
->
-<File
-RelativePath="..\Source\Core\Lua\Event.cpp"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\Event.h"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\LuaEventListener.cpp"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\LuaEventListener.h"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\LuaEventListenerInstancer.cpp"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\LuaEventListenerInstancer.h"
->
-</File>
-</Filter>
-<File
-RelativePath="..\Source\Core\Lua\Header.h"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\precompiled.cpp"
->
-</File>
-<File
-RelativePath="..\Source\Core\Lua\precompiled.h"
->
-</File>
-</Files>
-<Globals>
-</Globals>
-</VisualStudioProject>
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="RocketLua"
+	ProjectGUID="{FC02901C-3CE4-4625-856A-F180DC45A855}"
+	RootNamespace="RocketLua"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(IntDir)"
+			IntermediateDirectory="build\$(ProjectName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="2"
+			DeleteExtensionsOnClean="*.pch;*.obj;*.ilk;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.pgc;*.pgd;*.meta;$(TargetPath)"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="$(SolutionDir)..\Include;$(SolutionDir)..\Source\Core;$(SolutionDir)..\Dependencies\lua\src;"
+				PreprocessorDefinitions="_WIN32,_DEBUG,RocketLua_EXPORTS"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="2"
+				PrecompiledHeaderThrough="precompiled.h"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				LinkLibraryDependencies="false"
+				AdditionalDependencies="lua51.lib RocketCore_d.lib RocketControls_d.lib"
+				ShowProgress="0"
+				OutputFile="..\bin\$(ProjectName)_d.dll"
+				AdditionalLibraryDirectories="$(SolutionDir)..\bin"
+				GenerateManifest="false"
+				EnableUAC="false"
+				GenerateDebugInformation="true"
+				ImportLibrary="$(TargetDir)$(TargetName).lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(IntDir)"
+			IntermediateDirectory="build\$(ProjectName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="2"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="$(SolutionDir)..\Include;$(SolutionDir)..\Source\Core;$(SolutionDir)..\Dependencies\lua\src;"
+				PreprocessorDefinitions="_WIN32,NDEBUG,RocketLua_EXPORTS"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="1"
+				PrecompiledHeaderThrough="precompiled.h"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="lua51.lib RocketCore.lib RocketControls.lib"
+				OutputFile="..\bin\$(ProjectName).dll"
+				GenerateManifest="false"
+				GenerateDebugInformation="false"
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				ImportLibrary="$(TargetDir)$(TargetName).lib"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Controls"
+			>
+			<Filter
+				Name="Forms"
+				>
+				<File
+					RelativePath="..\Source\Controls\Lua\ElementForm.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\Source\Controls\Lua\ElementForm.h"
+					>
+				</File>
+				<File
+					RelativePath="..\Source\Controls\Lua\ElementFormControl.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\Source\Controls\Lua\ElementFormControl.h"
+					>
+				</File>
+			</Filter>
+		</Filter>
+		<Filter
+			Name="Core"
+			>
+			<File
+				RelativePath="..\Source\Core\Lua\Context.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\Source\Core\Lua\Context.h"
+				>
+			</File>
+			<File
+				RelativePath="..\Source\Core\Lua\Interpreter.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\Source\Core\Lua\Interpreter.h"
+				>
+			</File>
+			<File
+				RelativePath="..\Source\Core\Lua\Log.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\Source\Core\Lua\Log.h"
+				>
+			</File>
+			<File
+				RelativePath="..\Source\Core\Lua\lua.hpp"
+				>
+			</File>
+			<File
+				RelativePath="..\Source\Core\Lua\LuaType.h"
+				>
+			</File>
+			<File
+				RelativePath="..\Source\Core\Lua\LuaType.inl"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="..\Source\Core\Lua\Register.h"
+				>
+			</File>
+			<File
+				RelativePath="..\Source\Core\Lua\Rocket.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\Source\Core\Lua\Rocket.h"
+				>
+			</File>
+			<File
+				RelativePath="..\Source\Core\Lua\RocketLua.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\Source\Core\Lua\RocketLua.h"
+				>
+			</File>
+			<Filter
+				Name="Element"
+				>
+				<File
+					RelativePath="..\Source\Core\Lua\Element.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\Source\Core\Lua\Element.h"
+					>
+				</File>
+				<File
+					RelativePath="..\Source\Core\Lua\ElementStyle.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\Source\Core\Lua\ElementStyle.h"
+					>
+				</File>
+				<Filter
+					Name="Document"
+					>
+					<File
+						RelativePath="..\Source\Core\Lua\Document.cpp"
+						>
+					</File>
+					<File
+						RelativePath="..\Source\Core\Lua\Document.h"
+						>
+					</File>
+					<File
+						RelativePath="..\Source\Core\Lua\LuaDocument.cpp"
+						>
+					</File>
+					<File
+						RelativePath="..\Source\Core\Lua\LuaDocument.h"
+						>
+					</File>
+					<File
+						RelativePath="..\Source\Core\Lua\LuaDocumentElementInstancer.cpp"
+						>
+					</File>
+					<File
+						RelativePath="..\Source\Core\Lua\LuaDocumentElementInstancer.h"
+						>
+					</File>
+				</Filter>
+			</Filter>
+			<Filter
+				Name="Event"
+				>
+				<File
+					RelativePath="..\Source\Core\Lua\Event.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\Source\Core\Lua\Event.h"
+					>
+				</File>
+				<File
+					RelativePath="..\Source\Core\Lua\LuaEventListener.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\Source\Core\Lua\LuaEventListener.h"
+					>
+				</File>
+				<File
+					RelativePath="..\Source\Core\Lua\LuaEventListenerInstancer.cpp"
+					>
+				</File>
+				<File
+					RelativePath="..\Source\Core\Lua\LuaEventListenerInstancer.h"
+					>
+				</File>
+			</Filter>
+		</Filter>
+		<Filter
+			Name="Basic Types"
+			>
+			<File
+				RelativePath="..\Source\Core\Lua\Colourb.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\Source\Core\Lua\Colourb.h"
+				>
+			</File>
+			<File
+				RelativePath="..\Source\Core\Lua\Colourf.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\Source\Core\Lua\Colourf.h"
+				>
+			</File>
+			<File
+				RelativePath="..\Source\Core\Lua\Vector2f.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\Source\Core\Lua\Vector2f.h"
+				>
+			</File>
+			<File
+				RelativePath="..\Source\Core\Lua\Vector2i.cpp"
+				>
+			</File>
+			<File
+				RelativePath="..\Source\Core\Lua\Vector2i.h"
+				>
+			</File>
+		</Filter>
+		<File
+			RelativePath="..\Source\Core\Lua\Header.h"
+			>
+		</File>
+		<File
+			RelativePath="..\Source\Core\Lua\precompiled.cpp"
+			>
+			<FileConfiguration
+				Name="Debug|Win32"
+				>
+				<Tool
+					Name="VCCLCompilerTool"
+					UsePrecompiledHeader="1"
+				/>
+			</FileConfiguration>
+		</File>
+		<File
+			RelativePath="..\Source\Core\Lua\precompiled.h"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

+ 20 - 0
Include/Rocket/Core/Lua/Header.h

@@ -0,0 +1,20 @@
+#ifndef ROCKETLUAHEADER_H
+#define ROCKETLUAHEADER_H
+
+#include <Rocket/Core/Platform.h>
+
+#if !defined STATIC_LIB
+	#ifdef ROCKET_PLATFORM_WIN32
+		#ifdef RocketLua_EXPORTS
+			#define ROCKETLUA_API __declspec(dllexport)
+		#else
+			#define ROCKETLUA_API __declspec(dllimport)
+		#endif
+	#else
+		#define ROCKETLUA_API __attribute__((visibility("default")))
+	#endif
+#else
+	#define ROCKETLUA_API
+#endif
+
+#endif

+ 43 - 0
Include/Rocket/Core/Lua/Interpreter.h

@@ -0,0 +1,43 @@
+#ifndef ROCKETCORELUAINTERPRETER_H
+#define ROCKETCORELUALUATYPE_H 
+/*
+    This initializes the lua interpreter, and has functions to load the scripts
+    A glorified namespace, but I want the lua_State to be unchangeable
+*/
+
+#include <Rocket/Core/Lua/lua.hpp>
+#include <Rocket/Core/Plugin.h>
+
+namespace Rocket {
+namespace Core {
+namespace Lua {
+
+class Interpreter : public Plugin
+{
+public:
+    static void LoadFile(const Rocket::Core::String& file);
+    static void DoString(const Rocket::Core::String& str);
+    static void Report();
+
+    static void BeginCall(int funRef);
+    static bool ExecuteCall(int params = 0, int res = 0);
+    static void EndCall(int res = 0);
+
+    static lua_State* GetLuaState();
+    
+    //From Plugin
+    virtual int GetEventClasses();
+    virtual void OnInitialise();
+    virtual void OnShutdown();
+private:
+    //This will populate the global Lua table with all of the Lua types and some global functions
+    static inline void RegisterEverything(lua_State* L);
+    void Startup();
+
+    static lua_State* _L;
+};
+}
+}
+}
+#endif
+

+ 96 - 0
Include/Rocket/Core/Lua/LuaType.h

@@ -0,0 +1,96 @@
+#ifndef ROCKETCORELUALUATYPE_H
+#define ROCKETCORELUALUATYPE_H
+
+
+/*
+    This is mostly the definition of the Lua userdata that we give to the user
+*/
+#include <Rocket/Core/Lua/Header.h>
+#include <Rocket/Core/Lua/lua.hpp>
+
+namespace Rocket {
+namespace Core {
+namespace Lua {
+
+//As an example, if you used this macro like
+//LUAMETHOD(Unit,GetId)
+//it would result in code that looks like
+//{ "GetId", UnitGetId },
+//Which would force you to create a global function named UnitGetId in C with the correct function signature, usually int(*)(lua_State*,type*);
+#define LUAMETHOD(type,name) { #name, type##name },
+
+//See above, but the method must match the function signature int(*)(lua_State*) and as example:
+//LUAGETTER(Unit,Id) would mean you need a function named UnitGetAttrId
+//The first stack position will be the userdata
+#define LUAGETTER(type,varname) { #varname, type##GetAttr##varname },
+
+//Same method signature as above, but as example:
+//LUASETTER(Unit,Id) would mean you need a function named UnitSetAttrId
+//The first stack position will be the userdata, and the second will be value on the other side of the equal sign
+#define LUASETTER(type,varname) { #varname, type##SetAttr##varname },
+
+#define CHECK_BOOL(L,narg) (lua_toboolean((L),(narg)) > 0 ? true : false )
+#define LUACHECKOBJ(obj) if(obj == NULL) { lua_pushnil(L); return 1; }
+
+
+//replacement for luaL_reg that uses a different function pointer signature, but similar syntax
+template<typename T>
+struct ROCKETLUA_API RegType
+{
+    const char* name;
+    int (*ftnptr)(lua_State*,T*);
+};
+
+//this is for all of the methods available from Lua that call to the C functions
+template<typename T> ROCKETLUA_API RegType<T>* GetMethodTable();
+//this is for all of the function that 'get' an attribute/property
+template<typename T> ROCKETLUA_API luaL_reg* GetAttrTable();
+//this is for all of the functions that 'set' an attribute/property
+template<typename T> ROCKETLUA_API luaL_reg* SetAttrTable();
+//String representation of the class
+template<typename T> ROCKETLUA_API const char* GetTClassName();
+
+template<typename T>
+class ROCKETLUA_API LuaType
+{
+public:
+    typedef int (*ftnptr)(lua_State* L, T* ptr);
+    typedef struct { const char* name; ftnptr func; } RegType;
+
+    static void Register(lua_State *L);
+    static int push(lua_State *L, T* obj, bool gc=false);
+    static T* check(lua_State* L, int narg);
+
+    //for calling a C closure with upvalues
+    static int thunk(lua_State* L);
+    //pointer to string
+    static void tostring(char* buff, void* obj);
+    //these are metamethods
+    //.__gc
+    static int gc_T(lua_State* L);
+    //.__tostring
+    static int tostring_T(lua_State* L);
+    //.__index
+    static int index(lua_State* L);
+    //.__newindex
+    static int newindex(lua_State* L);
+	
+    //gets called from the Register function, right before _regfunctions.
+    //If you want to inherit from another class, in the function you would want
+    //to call _regfunctions<superclass>, where method is metatable_index - 1. Anything
+    //that has the same name in the subclass will be overwrite whatever had the 
+    //same name in the superclass.
+    static inline void extra_init(lua_State* L, int metatable_index);
+    //Registers methods,getters,and setters to the type
+    static inline void _regfunctions(lua_State* L, int meta, int method);
+private:
+    LuaType(); //hide constructor
+
+};
+
+}
+}
+}
+
+#include "LuaType.inl"
+#endif

+ 289 - 0
Include/Rocket/Core/Lua/LuaType.inl

@@ -0,0 +1,289 @@
+#include "precompiled.h"
+#include "LuaType.h"
+#include "Rocket.h"
+#include <Rocket/Core/Event.h>
+#include <Rocket/Core/Element.h>
+#include <Rocket/Core/ElementDocument.h>
+#include <Rocket/Core/ElementStyle.h>
+#include <Rocket/Core/Context.h>
+
+
+namespace Rocket {
+namespace Core {
+namespace Lua {
+typedef Rocket::Core::ElementDocument Document;
+
+template<typename T>
+void LuaType<T>::Register(lua_State* L)
+{
+    //for annotations, starting at 1, but it is a relative value, not always 1
+    lua_newtable(L); //[1] = table
+    int methods = lua_gettop(L); //methods = 1
+
+    luaL_newmetatable(L, GetTClassName<T>()); //[2] = metatable named <ClassName>, referred in here by ClassMT
+    int metatable = lua_gettop(L); //metatable = 2
+
+    luaL_newmetatable(L, "DO NOT TRASH"); //[3] = metatable named "DO NOT TRASH"
+    lua_pop(L,1); //remove the above metatable -> [-1 = 2]
+
+    //store method table in globals so that scripts can add functions written in Lua
+    lua_pushvalue(L, methods); //[methods = 1] -> [3] = copy (reference) of methods table
+    lua_setglobal(L, GetTClassName<T>()); // -> <ClassName> = [3 = 1], pop top [3]
+
+    //hide metatable from Lua getmetatable()
+    lua_pushvalue(L, methods); //[methods = 1] -> [3] = copy of methods table, including modifications above
+    lua_setfield(L, metatable, "__metatable"); //[metatable = 2] -> t[k] = v; t = [2 = ClassMT], k = "__metatable", v = [3 = 1]; pop [3]
+    
+    lua_pushcfunction(L, index); //index = cfunction -> [3] = cfunction
+    lua_setfield(L, metatable, "__index"); //[metatable = 2] -> t[k] = v; t = [2], k = "__index", v = cfunc; pop [3]
+
+    lua_pushcfunction(L, newindex);
+    lua_setfield(L, metatable, "__newindex");
+
+    lua_pushcfunction(L, gc_T);
+    lua_setfield(L, metatable, "__gc");
+
+    lua_pushcfunction(L, tostring_T);
+    lua_setfield(L, metatable, "__tostring");
+
+    extra_init(L,metatable); //imlemented by individual types
+
+    lua_newtable(L); //for method table -> [3] = this table
+    lua_setmetatable(L, methods); //[methods = 1] -> metatable for [1] is [3]; [3] is popped off, top = [2]
+
+    _regfunctions(L,metatable,methods);
+
+    lua_pop(L, 2); //remove the two items from the stack, [1 = methods] and [2 = metatable]
+}
+
+
+template<typename T>
+int LuaType<T>::push(lua_State *L, T* obj, bool gc)
+{
+    //for annotations, starting at index 1, but it is a relative number, not always 1
+    if (!obj) { lua_pushnil(L); return lua_gettop(L); }
+    luaL_getmetatable(L, GetTClassName<T>());  // lookup metatable in Lua registry ->[1] = metatable of <ClassName>
+    if (lua_isnil(L, -1)) luaL_error(L, "%s missing metatable", GetTClassName<T>());
+    int mt = lua_gettop(L); //mt = 1
+    T** ptrHold = (T**)lua_newuserdata(L,sizeof(T**)); //->[2] = empty userdata
+    int ud = lua_gettop(L); //ud = 2
+    if(ptrHold != NULL)
+    {
+        *ptrHold = obj; 
+        lua_pushvalue(L, mt); // ->[3] = copy of [1]
+        lua_setmetatable(L, -2); //[-2 = 2] -> [2]'s metatable = [3]; pop [3]
+        char name[32];
+        tostring(name,obj);
+        lua_getfield(L,LUA_REGISTRYINDEX,"DO NOT TRASH"); //->[3] = value returned from function
+        if(lua_isnil(L,-1) ) //if [3] hasn't been created yet, then create it
+        {
+            luaL_newmetatable(L,"DO NOT TRASH"); //[4] = the new metatable
+            lua_pop(L,1); //pop [4]
+        }
+        lua_getfield(L,LUA_REGISTRYINDEX,"DO NOT TRASH"); //->[3] = value returned from function
+        if(gc == false) //if we shouldn't garbage collect it, then put the name in to [3]
+        {
+            lua_pushboolean(L,1);// ->[4] = true
+            lua_setfield(L,-2,name); //represents t[k] = v, [-2 = 3] = t -> v = [4], k = <ClassName>; pop [4]
+        }
+        lua_pop(L,1); // -> pop [3]
+    }
+    lua_settop(L,ud); //[ud = 2] -> remove everything that is above 2, top = [2]
+    lua_replace(L, mt); //[mt = 1] -> move [2] to pos [1], and pop previous [1]
+    lua_settop(L, mt); //remove everything above [1]
+    return mt;  // index of userdata containing pointer to T object
+}
+
+
+template<typename T>
+T* LuaType<T>::check(lua_State* L, int narg)
+{
+    T** ptrHold = static_cast<T**>(lua_touserdata(L,narg));
+    if(ptrHold == NULL)
+        return NULL;
+    return (*ptrHold);
+}
+
+
+//private members
+
+template<typename T>
+int LuaType<T>::thunk(lua_State* L)
+{
+    // stack has userdata, followed by method args
+    T *obj = check(L, 1);  // get 'self', or if you prefer, 'this'
+    lua_remove(L, 1);  // remove self so member function args start at index 1
+    // get member function from upvalue
+    RegType *l = static_cast<RegType*>(lua_touserdata(L, lua_upvalueindex(1)));
+    // call member function
+    return l->func(L,obj);
+}
+
+
+template<typename T>
+void LuaType<T>::tostring(char* buff, void* obj)
+{
+    sprintf(buff,"%p",obj);
+}
+
+
+template<typename T>
+int LuaType<T>::gc_T(lua_State* L)
+{
+    T * obj = check(L,1); //[1] = this userdata
+    if(obj == NULL)
+        return 0;
+    lua_getfield(L,LUA_REGISTRYINDEX,"DO NOT TRASH"); //->[2] = return value from this
+    if(lua_istable(L,-1) ) //[-1 = 2], if it is a table
+    {
+        char name[32];
+        tostring(name,obj);
+        lua_getfield(L,-1, std::string(name).c_str()); //[-1 = 2] -> [3] = the value returned from if <ClassName> exists in the table to not gc
+        if(lua_isnil(L,-1) ) //[-1 = 3] if it doesn't exist, then we are free to garbage collect c++ side
+        {
+            delete obj;
+            obj = NULL;
+        }
+    }
+    lua_pop(L,3); //balance function
+    return 0;
+}
+
+
+template<typename T>
+int LuaType<T>::tostring_T(lua_State* L)
+{
+    char buff[32];
+    T** ptrHold = (T**)lua_touserdata(L,1);
+    T *obj = *ptrHold;
+    sprintf(buff, "%p", obj);
+    lua_pushfstring(L, "%s (%s)", GetTClassName<T>(), buff);
+    return 1;
+}
+
+
+
+template<typename T>
+int LuaType<T>::index(lua_State* L)
+{
+    /*the table obj and the missing key are currently on the stack(index 1 & 2) as defined by the Lua language*/
+    lua_getglobal(L,GetTClassName<T>()); //stack pos [3] (fairly important, just refered to as [3])
+    // string form of the key.
+	const char* key = luaL_checkstring(L,2);
+    if(lua_istable(L,-1) )  //[-1 = 3]
+    {
+        lua_pushvalue(L,2); //[2] = key, [4] = copy of key
+        lua_rawget(L,-2); //[-2 = 3] -> pop top and push the return value to top [4]
+        //If the key were looking for is not in the table, retrieve its' metatables' index value.
+        if(lua_isnil(L,-1)) //[-1 = 4] is value from rawget above
+        {
+            //try __getters
+            lua_pop(L,1); //remove top item (nil) from the stack
+            lua_pushstring(L, "__getters");
+            lua_rawget(L,-2); //[-2 = 3], <ClassName>._getters -> result to [4]
+            lua_pushvalue(L,2); //[2 = key] -> copy to [5]
+            lua_rawget(L,-2); //[-2 = __getters] -> __getters[key], result to [5]
+            if(lua_type(L,-1) == LUA_TFUNCTION) //[-1 = 5]
+            {
+                lua_pushvalue(L,1); //push the userdata to the stack [6]
+                lua_pcall(L,1,1,0); //remove one, result is at [6]
+            }
+            else
+            {
+                lua_settop(L,4); //forget everything we did above
+                lua_getmetatable(L,-2); //[-2 = 3] -> metatable from <ClassName> to top [5]
+                if(lua_istable(L,-1) ) //[-1 = 5] = the result of the above
+                {
+                    lua_getfield(L,-1,"__index"); //[-1 = 5] = check the __index metamethod for the metatable-> push result to [6]
+                    if(lua_isfunction(L,-1) ) //[-1 = 6] = __index metamethod
+                    {
+                        lua_pushvalue(L,1); //[1] = object -> [7] = object
+                        lua_pushvalue(L,2); //[2] = key -> [8] = key
+                        lua_pcall(L,2,1,0); //call function at top of stack (__index) -> pop top 2 as args; [7] = return value
+                    }
+                    else if(lua_istable(L,-1) )
+                        lua_getfield(L,-1,key); //shorthand version of above -> [7] = return value
+                    else
+                        lua_pushnil(L); //[7] = nil
+                }
+                else
+                    lua_pushnil(L); //[6] = nil
+            }
+        }
+        else if(lua_istable(L,-1) )//[-1 = 4] is value from rawget [3]
+        {
+            lua_pushvalue(L,2); //[2] = key, [5] = key
+            lua_rawget(L,-2); //[-2 = 3] = table of <ClassName> -> pop top and push the return value to top [5]
+        }
+    }
+    else
+        lua_pushnil(L); //[4] = nil
+
+    lua_insert(L,1); //top element to position 1 -> [1] = top element as calculated in the earlier rest of the function
+    lua_settop(L,1); // -> [1 = -1], removes the other elements
+    return 1;
+}
+
+
+
+template<typename T>
+int LuaType<T>::newindex(lua_State* L)
+{
+    //[1] = obj, [2] = key, [3] = value
+    //look for it in __setters
+    lua_getglobal(L,GetTClassName<T>()); //[4] = this table
+    lua_pushstring(L,"__setters"); //[5]
+    lua_rawget(L,-2); //[-2 = 4] -> <ClassName>.__setters to [5]
+    lua_pushvalue(L,2); //[2 = key] -> [6] = copy of key
+    lua_rawget(L,-2); //[-2 = __setters] -> __setters[key] to [6]
+    if(lua_type(L,-1) == LUA_TFUNCTION)
+    {
+        lua_pushvalue(L,1); //userdata at [7]
+        lua_pushvalue(L,3); //[8] = copy of [3]
+        lua_pcall(L,2,0,0); //call function, pop 2 off push 0 on
+    }
+    else
+        lua_pop(L,1); //not a setter function.
+    lua_pop(L,2); //pop __setters and the <Classname> table
+    return 0;
+}
+
+template<typename T>
+void LuaType<T>::extra_init(lua_State* L, int metatable_index)
+{
+    //empty, because it should be implemented by other types
+    return;
+}
+
+template<typename T>
+void LuaType<T>::_regfunctions(lua_State* L, int meta, int methods)
+{
+    //fill method table with methods.
+    for(RegType* m = (RegType*)GetMethodTable<T>(); m->name; m++)
+    {
+        lua_pushstring(L, m->name); // ->[3] = name of function Lua side
+        lua_pushlightuserdata(L, (void*)m); // ->[4] = pointer to the object containing the name and the function pointer as light userdata
+        lua_pushcclosure(L, thunk, 1); //thunk = function pointer -> pop 1 item from stack, [4] = closure
+        lua_settable(L, methods); // represents t[k] = v, t = [methods = 1] -> pop [4 = closure] to be v, pop [3 = name] to be k
+    }
+
+    lua_newtable(L); // -> table [3]
+    for(luaL_reg* m = (luaL_reg*)GetAttrTable<T>(); m->name; m++)
+    {
+        lua_pushcfunction(L,m->func); // -> [4] is this function
+        lua_setfield(L,-2,m->name); //[-2 = 3] -> table.name = function
+    }
+    lua_setfield(L,methods, "__getters"); //[methods = 1], methods.__getters = table, pop table
+
+    lua_newtable(L); // -> table [3]
+    for(luaL_reg* m = (luaL_reg*)SetAttrTable<T>(); m->name; m++)
+    {
+        lua_pushcfunction(L,m->func); // -> [4] is this function
+        lua_setfield(L,-2,m->name); //[-2 = 3] -> table.name = function
+    }
+    lua_setfield(L,methods, "__setters"); //[methods = 1], methods.__setters = table, pop table
+}
+
+}
+}
+}

+ 7 - 0
Include/Rocket/Core/Lua/lua.hpp

@@ -0,0 +1,7 @@
+//The standard Lua headers
+
+extern "C" {
+#include "lua.h"
+#include "lauxlib.h"
+#include "lualib.h"
+}

+ 49 - 0
Source/Controls/Lua/ElementForm.cpp

@@ -0,0 +1,49 @@
+#include "precompiled.h"
+#include "ElementForm.h"
+#include <Rocket/Core/Element.h>
+#include <Rocket/Controls/ElementForm.h>
+
+namespace Rocket {
+namespace Core {
+namespace Lua {
+
+template<> void LuaType<ElementForm>::extra_init(lua_State* L, int metatable_index)
+{
+    //inherit from Element
+    LuaType<Element>::_regfunctions(L,metatable_index,metatable_index-1);
+}
+
+//method
+int ElementFormSubmit(lua_State* L, ElementForm* obj)
+{
+    LUACHECKOBJ(obj);
+    const char* name = luaL_checkstring(L,1);
+    const char* value = luaL_checkstring(L,2);
+    obj->Submit(name,value);
+    return 0;
+}
+
+RegType<ElementForm> ElementFormMethods[] =
+{
+    LUAMETHOD(ElementForm,Submit)
+    { NULL, NULL },
+};
+
+luaL_reg ElementFormGetters[] =
+{
+    { NULL, NULL },
+};
+
+luaL_reg ElementFormSetters[] =
+{
+    { NULL, NULL },
+};
+
+template<> const char* GetTClassName<ElementForm>() { return "ElementForm"; }
+template<> RegType<ElementForm>* GetMethodTable<ElementForm>() { return ElementFormMethods; }
+template<> luaL_reg* GetAttrTable<ElementForm>() { return ElementFormGetters; }
+template<> luaL_reg* SetAttrTable<ElementForm>() { return ElementFormSetters; }
+
+}
+}
+}

+ 42 - 0
Source/Controls/Lua/ElementForm.h

@@ -0,0 +1,42 @@
+#pragma once
+/*
+    This defines the ElementForm type in the Lua global namespace
+
+    methods:
+    ElementForm:Submit(string name,string value)
+
+    for everything else, see the documentation for "Element"
+*/
+
+#include <Rocket/Core/Lua/LuaType.h>
+#include <Rocket/Core/Lua/lua.hpp>
+#include <Rocket/Controls/ElementForm.h>
+/*
+    This defines the ElementForm type in the Lua global namespace
+
+    It has one method
+    noreturn ElementForm:Submit(string name,string value)
+*/
+
+using Rocket::Controls::ElementForm;
+namespace Rocket {
+namespace Core {
+namespace Lua {
+//this will be used to "inherit" from Element
+template<> void LuaType<ElementForm>::extra_init(lua_State* L, int metatable_index);
+
+//method
+int ElementFormSubmit(lua_State* L, ElementForm* obj);
+
+RegType<ElementForm> ElementFormMethods[];
+luaL_reg ElementFormGetters[];
+luaL_reg ElementFormSetters[];
+
+template<> const char* GetTClassName<ElementForm>();
+template<> RegType<ElementForm>* GetMethodTable<ElementForm>();
+template<> luaL_reg* GetAttrTable<ElementForm>();
+template<> luaL_reg* SetAttrTable<ElementForm>();
+
+}
+}
+}

+ 99 - 0
Source/Controls/Lua/ElementFormControl.cpp

@@ -0,0 +1,99 @@
+#include "precompiled.h"
+#include "ElementFormControl.h"
+#include <Rocket/Controls/ElementFormControl.h>
+#include <Rocket/Core/Element.h>
+
+using Rocket::Controls::ElementFormControl;
+namespace Rocket {
+namespace Core {
+namespace Lua {
+//this will be used to "inherit" from Element
+template<> void LuaType<ElementFormControl>::extra_init(lua_State* L, int metatable_index)
+{
+    LuaType<Element>::_regfunctions(L,metatable_index,metatable_index-1);
+}
+
+//getters
+int ElementFormControlGetAttrdisabled(lua_State* L)
+{
+    ElementFormControl* efc = LuaType<ElementFormControl>::check(L,1);
+    LUACHECKOBJ(efc);
+    lua_pushboolean(L,efc->IsDisabled());
+    return 1;
+}
+
+int ElementFormControlGetAttrname(lua_State* L)
+{
+    ElementFormControl* efc = LuaType<ElementFormControl>::check(L,1);
+    LUACHECKOBJ(efc);
+    lua_pushstring(L,efc->GetName().CString());
+    return 1;
+}
+
+int ElementFormControlGetAttrvalue(lua_State* L)
+{
+    ElementFormControl* efc = LuaType<ElementFormControl>::check(L,1);
+    LUACHECKOBJ(efc);
+    lua_pushstring(L,efc->GetValue().CString());
+    return 1;
+}
+
+
+//setters
+int ElementFormControlSetAttrdisabled(lua_State* L)
+{
+    ElementFormControl* efc = LuaType<ElementFormControl>::check(L,1);
+    LUACHECKOBJ(efc);
+    efc->SetDisabled(CHECK_BOOL(L,2));
+    return 0;
+}
+
+int ElementFormControlSetAttrname(lua_State* L)
+{
+    ElementFormControl* efc = LuaType<ElementFormControl>::check(L,1);
+    LUACHECKOBJ(efc);
+    const char* name = luaL_checkstring(L,2);
+    efc->SetName(name);
+    return 0;
+}
+
+int ElementFormControlSetAttrvalue(lua_State* L)
+{
+    ElementFormControl* efc = LuaType<ElementFormControl>::check(L,1);
+    LUACHECKOBJ(efc);
+    const char* value = luaL_checkstring(L,2);
+    efc->SetValue(value);
+    return 0;
+}
+
+
+RegType<ElementFormControl> ElementFormControlMethods[] = 
+{
+    { NULL, NULL },
+};
+
+luaL_reg ElementFormControlGetters[] = 
+{
+    LUAGETTER(ElementFormControl,disabled)
+    LUAGETTER(ElementFormControl,name)
+    LUAGETTER(ElementFormControl,value)
+    { NULL, NULL },
+};
+
+luaL_reg ElementFormControlSetters[] = 
+{
+    LUASETTER(ElementFormControl,disabled)
+    LUASETTER(ElementFormControl,name)
+    LUASETTER(ElementFormControl,value)
+    { NULL, NULL },
+};
+
+
+template<> const char* GetTClassName<ElementFormControl>() { return "ElementFormControl"; }
+template<> RegType<ElementFormControl>* GetMethodTable<ElementFormControl>() { return ElementFormControlMethods; }
+template<> luaL_reg* GetAttrTable<ElementFormControl>() { return ElementFormControlGetters; }
+template<> luaL_reg* SetAttrTable<ElementFormControl>() { return ElementFormControlSetters; }
+
+}
+}
+}

+ 43 - 0
Source/Controls/Lua/ElementFormControl.h

@@ -0,0 +1,43 @@
+#pragma once
+/*
+    This defines the ElementFormControl type in the Lua global namespace
+
+    it has no methods, and all of the attributes are read and write
+
+    bool    ElementFormControl.disabled
+    string  ElementFormControl.name
+    string  ElementFormControl.value
+*/
+#include <Rocket/Core/Lua/lua.hpp>
+#include <Rocket/Core/Lua/LuaType.h>
+#include <Rocket/Controls/ElementFormControl.h>
+
+using Rocket::Controls::ElementFormControl;
+namespace Rocket {
+namespace Core {
+namespace Lua {
+//this will be used to "inherit" from Element
+template<> void LuaType<ElementFormControl>::extra_init(lua_State* L, int metatable_index);
+
+//getters
+int ElementFormControlGetAttrdisabled(lua_State* L);
+int ElementFormControlGetAttrname(lua_State* L);
+int ElementFormControlGetAttrvalue(lua_State* L);
+
+//setters
+int ElementFormControlSetAttrdisabled(lua_State* L);
+int ElementFormControlSetAttrname(lua_State* L);
+int ElementFormControlSetAttrvalue(lua_State* L);
+
+RegType<ElementFormControl> ElementFormControlMethods[];
+luaL_reg ElementFormControlGetters[];
+luaL_reg ElementFormControlSetters[];
+
+template<> const char* GetTClassName<ElementFormControl>();
+template<> RegType<ElementFormControl>* GetMethodTable<ElementFormControl>();
+template<> luaL_reg* GetAttrTable<ElementFormControl>();
+template<> luaL_reg* SetAttrTable<ElementFormControl>();
+
+}
+}
+}

+ 16 - 2
Source/Core/Lua/Interpreter.cpp

@@ -2,7 +2,7 @@
 #include "Interpreter.h"
 #include <Rocket/Core/Log.h>
 #include <Rocket/Core/String.h>
-#include "LuaType.h"
+#include <Rocket/Core/Lua/LuaType.h>
 #include "LuaDocumentElementInstancer.h"
 #include <Rocket/Core/Factory.h>
 #include "LuaEventListenerInstancer.h"
@@ -24,7 +24,21 @@ void Interpreter::Startup()
 
 void Interpreter::RegisterEverything(lua_State* L)
 {
-#include "Register.h" //think of it as a glorified macro file
+    LuaType<Vector2i>::Register(L);
+    LuaType<Vector2f>::Register(L);
+    LuaType<Colourf>::Register(L);
+    LuaType<Colourb>::Register(L);
+    LuaType<Log>::Register(L);
+    LuaType<Element>::Register(L);
+        //things that inherit from Element
+        LuaType<Document>::Register(L);
+        LuaType<ElementStyle>::Register(L);
+        //controls that inherit from Element
+        LuaType<Rocket::Controls::ElementForm>::Register(L);
+        LuaType<Rocket::Controls::ElementFormControl>::Register(L);
+    LuaType<Event>::Register(L);
+    LuaType<Context>::Register(L);
+    LuaType<rocket>::Register(L);
 }
 
 

+ 4 - 2
Source/Core/Lua/Interpreter.h

@@ -1,10 +1,11 @@
-#pragma once
+#ifndef ROCKETCORELUAINTERPRETER_H
+#define ROCKETCORELUALUATYPE_H 
 /*
     This initializes the lua interpreter, and has functions to load the scripts
     A glorified namespace, but I want the lua_State to be unchangeable
 */
 
-#include "lua.hpp"
+#include <Rocket/Core/Lua/lua.hpp>
 #include <Rocket/Core/Plugin.h>
 
 namespace Rocket {
@@ -38,4 +39,5 @@ private:
 }
 }
 }
+#endif
 

+ 7 - 4
Source/Core/Lua/LuaType.h

@@ -1,10 +1,12 @@
-#pragma once
+#ifndef ROCKETCORELUALUATYPE_H
+#define ROCKETCORELUALUATYPE_H
+
 
 /*
     This is mostly the definition of the Lua userdata that we give to the user
 */
-#include "Header.h"
-#include "lua.hpp"
+#include <Rocket/Core/Lua/Header.h>
+#include <Rocket/Core/Lua/lua.hpp>
 
 namespace Rocket {
 namespace Core {
@@ -90,4 +92,5 @@ private:
 }
 }
 
-#include "LuaType.inl"
+#include "LuaType.inl"
+#endif

+ 3 - 1
Source/Core/Lua/precompiled.h

@@ -1,3 +1,5 @@
 #pragma once
 #include <Rocket/Core/Core.h>
-#include <Rocket/Core/Debug.h>
+#include <Rocket/Core/Debug.h>
+#include <Rocket/Controls/Controls.h>
+#include <Rocket/Core/Lua/LuaType.h>