Skip to content

Commit

Permalink
Next test
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelIT7 committed Apr 5, 2024
1 parent 0c1bacf commit 810ec23
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion _testing/gmod_testing.lua
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ local ret, err = pcall(function()
iFace:InitGmod()
iFace:RunFile("includes/init.lua")
iFace:RunString(code)
iFace:RunHook("ExampleHook", "ExampleArg", 1234, Vector(1, 2, 3))
iFace:RunHook("ExampleHook", "ExampleArg", 1234, true)
end)

if err then
Expand Down
23 changes: 16 additions & 7 deletions source/lua_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,9 @@ void PushValue(GarrysMod::Lua::ILuaBase* LUA, ILuaValue* value)

void SafeDelete(ILuaValue* value)
{
if (value->type == GarrysMod::Lua::Type::Table)
for (auto& [key, val] : value->tbl)
{
for (auto& [key, val] : value->tbl)
{
SafeDelete(val);
}
SafeDelete(val);
}

delete value;
Expand Down Expand Up @@ -129,11 +126,23 @@ void FillValue(GarrysMod::Lua::ILuaBase* LUA, ILuaValue* val, int iStackPos, int
} else if (type == GarrysMod::Lua::Type::Vector)
{
val->type = type;
val->vec = LUA->GetVector(iStackPos);
if (ThreadInMainThread())
{
val->vec = LUA->GetVector(iStackPos);
} else {
LUA_Vector* vec = Vector_Get(LUA, iStackPos);
val->vec = Vector(vec->x, vec->y, vec->z);
}
} else if (type == GarrysMod::Lua::Type::Angle)
{
val->type = type;
val->ang = LUA->GetAngle(iStackPos);
if (ThreadInMainThread())
{
val->ang = LUA->GetAngle(iStackPos);
} else {
LUA_Angle* ang = Angle_Get(LUA, iStackPos);
val->ang = QAngle(ang->x, ang->y, ang->z);
}
} else if (type == GarrysMod::Lua::Type::Table)
{
val->type = type;
Expand Down

0 comments on commit 810ec23

Please sign in to comment.