Skip to content

Commit

Permalink
Update to game build 2023r173
Browse files Browse the repository at this point in the history
  • Loading branch information
SDraw committed Nov 14, 2023
1 parent c789405 commit b2ccc34
Show file tree
Hide file tree
Showing 4 changed files with 1,119 additions and 1,139 deletions.
277 changes: 127 additions & 150 deletions CVRLua/Lua/LuaDefs/CVRPointerDefs.cs
Original file line number Diff line number Diff line change
@@ -1,150 +1,127 @@
using ABI.CCK.Components;
using System;
using System.Collections.Generic;

namespace CVRLua.Lua.LuaDefs
{
static class CVRPointerDefs
{
const string c_destroyed = "CVRPointer is destroyed";

static readonly List<(string, LuaInterop.lua_CFunction)> ms_metaMethods = new List<(string, LuaInterop.lua_CFunction)>();
static readonly List<(string, (LuaInterop.lua_CFunction, LuaInterop.lua_CFunction))> ms_staticProperties = new List<(string, (LuaInterop.lua_CFunction, LuaInterop.lua_CFunction))>();
static readonly List<(string, LuaInterop.lua_CFunction)> ms_staticMethods = new List<(string, LuaInterop.lua_CFunction)>();
static readonly List<(string, (LuaInterop.lua_CFunction, LuaInterop.lua_CFunction))> ms_instanceProperties = new List<(string, (LuaInterop.lua_CFunction, LuaInterop.lua_CFunction))>();
static readonly List<(string, LuaInterop.lua_CFunction)> ms_instanceMethods = new List<(string, LuaInterop.lua_CFunction)>();

internal static void Init()
{
ms_instanceProperties.Add(("isInternalPointer", (GetIsInternalPointer, null)));
ms_instanceProperties.Add(("isLocalPointer", (GetIsLocalPointer, null)));
ms_instanceProperties.Add(("limitToFilteredTriggers", (GetLimitToFilteredTriggers, null)));
ms_instanceProperties.Add(("type", (GetPointerType, SetPointerType)));

MonoBehaviourDefs.InheritTo(ms_metaMethods, ms_staticProperties, ms_staticMethods, ms_instanceProperties, ms_instanceMethods);
}

static internal void RegisterInVM(LuaVM p_vm)
{
p_vm.RegisterClass(typeof(CVRPointer), null, ms_staticProperties, ms_staticMethods, ms_metaMethods, ms_instanceProperties, ms_instanceMethods);
p_vm.RegisterFunction(nameof(IsCVRPointer), IsCVRPointer);
}

// Static methods
static int IsCVRPointer(IntPtr p_state)
{
var l_argReader = new LuaArgReader(p_state);
CVRPointer l_pointer = null;
l_argReader.ReadNextObject(ref l_pointer);
l_argReader.PushBoolean(l_pointer != null);
return l_argReader.GetReturnValue();
}

// Instance methods
static int GetIsInternalPointer(IntPtr p_state)
{
var l_argReader = new LuaArgReader(p_state);
CVRPointer l_pointer = null;
l_argReader.ReadObject(ref l_pointer);
if(!l_argReader.HasErrors())
{
if(l_pointer != null)
l_argReader.PushBoolean(l_pointer.isInternalPointer);
else
{
l_argReader.SetError(c_destroyed);
l_argReader.PushBoolean(false);
}
}
else
l_argReader.PushBoolean(false);

l_argReader.LogError();
return 1;
}

static int GetIsLocalPointer(IntPtr p_state)
{
var l_argReader = new LuaArgReader(p_state);
CVRPointer l_pointer = null;
l_argReader.ReadObject(ref l_pointer);
if(!l_argReader.HasErrors())
{
if(l_pointer != null)
l_argReader.PushBoolean(l_pointer.isLocalPointer);
else
{
l_argReader.SetError(c_destroyed);
l_argReader.PushBoolean(false);
}
}
else
l_argReader.PushBoolean(false);

l_argReader.LogError();
return 1;
}

static int GetLimitToFilteredTriggers(IntPtr p_state)
{
var l_argReader = new LuaArgReader(p_state);
CVRPointer l_pointer = null;
l_argReader.ReadObject(ref l_pointer);
if(!l_argReader.HasErrors())
{
if(l_pointer != null)
l_argReader.PushBoolean(l_pointer.limitToFilteredTriggers);
else
{
l_argReader.SetError(c_destroyed);
l_argReader.PushBoolean(false);
}
}
else
l_argReader.PushBoolean(false);

l_argReader.LogError();
return 1;
}

static int GetPointerType(IntPtr p_state)
{
var l_argReader = new LuaArgReader(p_state);
CVRPointer l_pointer = null;
l_argReader.ReadObject(ref l_pointer);
if(!l_argReader.HasErrors())
{
if(l_pointer != null)
l_argReader.PushString(l_pointer.type);
else
{
l_argReader.SetError(c_destroyed);
l_argReader.PushBoolean(false);
}
}
else
l_argReader.PushBoolean(false);

l_argReader.LogError();
return 1;
}
static int SetPointerType(IntPtr p_state)
{
var l_argReader = new LuaArgReader(p_state);
CVRPointer l_pointer = null;
string l_type = "";
l_argReader.ReadObject(ref l_pointer);
l_argReader.ReadString(ref l_type);
if(!l_argReader.HasErrors())
{
if(l_pointer != null)
l_pointer.type = l_type;
else
l_argReader.SetError(c_destroyed);
}

l_argReader.LogError();
return 0;
}
}
}
using ABI.CCK.Components;
using System;
using System.Collections.Generic;

namespace CVRLua.Lua.LuaDefs
{
static class CVRPointerDefs
{
const string c_destroyed = "CVRPointer is destroyed";

static readonly List<(string, LuaInterop.lua_CFunction)> ms_metaMethods = new List<(string, LuaInterop.lua_CFunction)>();
static readonly List<(string, (LuaInterop.lua_CFunction, LuaInterop.lua_CFunction))> ms_staticProperties = new List<(string, (LuaInterop.lua_CFunction, LuaInterop.lua_CFunction))>();
static readonly List<(string, LuaInterop.lua_CFunction)> ms_staticMethods = new List<(string, LuaInterop.lua_CFunction)>();
static readonly List<(string, (LuaInterop.lua_CFunction, LuaInterop.lua_CFunction))> ms_instanceProperties = new List<(string, (LuaInterop.lua_CFunction, LuaInterop.lua_CFunction))>();
static readonly List<(string, LuaInterop.lua_CFunction)> ms_instanceMethods = new List<(string, LuaInterop.lua_CFunction)>();

internal static void Init()
{
ms_instanceProperties.Add(("isInternalPointer", (GetIsInternalPointer, null)));
ms_instanceProperties.Add(("isLocalPointer", (GetIsLocalPointer, null)));
ms_instanceProperties.Add(("type", (GetPointerType, SetPointerType)));

MonoBehaviourDefs.InheritTo(ms_metaMethods, ms_staticProperties, ms_staticMethods, ms_instanceProperties, ms_instanceMethods);
}

static internal void RegisterInVM(LuaVM p_vm)
{
p_vm.RegisterClass(typeof(CVRPointer), null, ms_staticProperties, ms_staticMethods, ms_metaMethods, ms_instanceProperties, ms_instanceMethods);
p_vm.RegisterFunction(nameof(IsCVRPointer), IsCVRPointer);
}

// Static methods
static int IsCVRPointer(IntPtr p_state)
{
var l_argReader = new LuaArgReader(p_state);
CVRPointer l_pointer = null;
l_argReader.ReadNextObject(ref l_pointer);
l_argReader.PushBoolean(l_pointer != null);
return l_argReader.GetReturnValue();
}

// Instance methods
static int GetIsInternalPointer(IntPtr p_state)
{
var l_argReader = new LuaArgReader(p_state);
CVRPointer l_pointer = null;
l_argReader.ReadObject(ref l_pointer);
if(!l_argReader.HasErrors())
{
if(l_pointer != null)
l_argReader.PushBoolean(l_pointer.isInternalPointer);
else
{
l_argReader.SetError(c_destroyed);
l_argReader.PushBoolean(false);
}
}
else
l_argReader.PushBoolean(false);

l_argReader.LogError();
return 1;
}

static int GetIsLocalPointer(IntPtr p_state)
{
var l_argReader = new LuaArgReader(p_state);
CVRPointer l_pointer = null;
l_argReader.ReadObject(ref l_pointer);
if(!l_argReader.HasErrors())
{
if(l_pointer != null)
l_argReader.PushBoolean(l_pointer.isLocalPointer);
else
{
l_argReader.SetError(c_destroyed);
l_argReader.PushBoolean(false);
}
}
else
l_argReader.PushBoolean(false);

l_argReader.LogError();
return 1;
}

static int GetPointerType(IntPtr p_state)
{
var l_argReader = new LuaArgReader(p_state);
CVRPointer l_pointer = null;
l_argReader.ReadObject(ref l_pointer);
if(!l_argReader.HasErrors())
{
if(l_pointer != null)
l_argReader.PushString(l_pointer.type);
else
{
l_argReader.SetError(c_destroyed);
l_argReader.PushBoolean(false);
}
}
else
l_argReader.PushBoolean(false);

l_argReader.LogError();
return 1;
}
static int SetPointerType(IntPtr p_state)
{
var l_argReader = new LuaArgReader(p_state);
CVRPointer l_pointer = null;
string l_type = "";
l_argReader.ReadObject(ref l_pointer);
l_argReader.ReadString(ref l_type);
if(!l_argReader.HasErrors())
{
if(l_pointer != null)
l_pointer.type = l_type;
else
l_argReader.SetError(c_destroyed);
}

l_argReader.LogError();
return 0;
}
}
}
Loading

0 comments on commit b2ccc34

Please sign in to comment.