Skip to content

Commit

Permalink
feat: lua: add simple Lua Object C++ checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Panakotta00 committed Oct 29, 2024
1 parent 9617014 commit 4933810
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Source/FicsItNetworksLua/Public/FINLua/Reflection/LuaObject.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include "FicsItReflection.h"
#include "FINLua/LuaUtil.h"
#include "Reflection/FIRClass.h"

Expand Down Expand Up @@ -68,6 +69,14 @@ namespace FINLua {
* @return the trace/object of the lua object in the lua stack, None if type check failed
*/
FFIRTrace luaFIN_checkObject(lua_State* L, int Index, UFIRClass* ParentType);
template<class T>
FFIRTrace luaFIN_checkTrace(lua_State* L, int Index) {
return luaFIN_checkObject(L, Index, FFicsItReflectionModule::Get().FindClass(T::StaticClass()));
}
template<class T>
T* luaFIN_checkObject(lua_State* L, int Index) {
return Cast<T>(luaFIN_checkObject(L, Index, FFicsItReflectionModule::Get().FindClass(T::StaticClass())).Get());
}

/**
* @return The Lua Metatable/Type-Name of Object
Expand Down

0 comments on commit 4933810

Please sign in to comment.