1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
| #include "UnLuaEx.h" #include "LuaCore.h" #include "ProfileTag.h" static int32 FProfileTag_New(lua_State *L) { int32 NumParams = lua_gettop(L); if (NumParams < 1) { UE_LOG(LogUnLua, Log, TEXT("%s: Invalid parameters!"), ANSI_TO_TCHAR(__FUNCTION__)); return 0; }
void *Userdata = NewTypedUserdata(L, FProfileTag); FProfileTag *V = new(Userdata) FProfileTag(); if (NumParams > 1) { FString Name = ANSI_TO_TCHAR((char*)lua_tostring(L,2)); V->Begin(Name); } return 1; }
static int32 FProfileTag_Begin(lua_State *L) { int32 NumParams = lua_gettop(L); if (NumParams < 1) { UE_LOG(LogUnLua, Log, TEXT("%s: Invalid parameters!"), ANSI_TO_TCHAR(__FUNCTION__)); return 0; }
FProfileTag *V = (FProfileTag*)GetCppInstanceFast(L, 1); if (!V) { UE_LOG(LogUnLua, Log, TEXT("%s: Invalid FProfileTag!"), ANSI_TO_TCHAR(__FUNCTION__)); return 0; } FString Name = ANSI_TO_TCHAR((char*)lua_tostring(L,2)); V->Begin(Name); return 0; } static int32 FProfileTag_End(lua_State *L) { int32 NumParams = lua_gettop(L); if (NumParams < 1) { UE_LOG(LogUnLua, Log, TEXT("%s: Invalid parameters!"), ANSI_TO_TCHAR(__FUNCTION__)); return 0; }
FProfileTag *V = (FProfileTag*)GetCppInstanceFast(L, 1); if (!V) { UE_LOG(LogUnLua, Log, TEXT("%s: Invalid FProfileTag!"), ANSI_TO_TCHAR(__FUNCTION__)); return 0; } V->End(); return 0; }
static const luaL_Reg FProfileTagLib[] = { {"__call",FProfileTag_New}, { "Begin", FProfileTag_Begin }, { "End", FProfileTag_End }, { nullptr, nullptr } };
BEGIN_EXPORT_REFLECTED_CLASS(FProfileTag) ADD_STATIC_FUNCTION_EX("StaticBegin",void,StaticBegin,const FString&) ADD_STATIC_FUNCTION_EX("StaticEnd",void,StaticEnd) ADD_LIB(FProfileTagLib) END_EXPORT_CLASS() IMPLEMENT_EXPORTED_CLASS(FProfileTag)
|