Right, I do understand a "return" will cause a call stack break in the current function, but I'm trying to see if there is a way to make another function cause the stack to end. Such as:
function ACHIEVEMENT:Unlock( ply, type, group, reward, item ) -- REQUIRED: This determines what to do once an achievement has been unlocked. If this function is not present, this achievement will not be loaded.
if not type or type ~= "kills" or type ~= "time" or type ~= "amount" then
ASET.Break( "Invalid type " .. tostring( type ) or "nil" .. " given." )
end
if hook.Call( "ASETAchievementUnlocked", nil, ply, ACHIEVEMENT.Type ) == false then return end
net.Start( "Achievement_Unlocked" )
net.WriteString( type ) -- Only guaranteed val to write.
if group then net.WriteString( group ) end
if reward then net.WriteInt( reward, 32 ) end -- Sign high, because I'm not sure what your reward will be.
if item then net.WriteString( item ) end -- Should be item class
if ply then net.Send( ply ) else net.Broadcast() end
end
And then I use my previous Break() function:
function ASET.Break( message )
ServerLog( message ) -- Or some other way to show message, but I'll figure that out later.
return -- Would this cause the call stack to end?
end
So I tried running this on
repl.it and that didn't seem to work. I don't like the look of having scattered "return"s in my code, so I'd like to have a function do it.