Page 1 of 1

See if your function is running in an alias or a trigger

Posted: Fri Apr 08, 2011 11:14 pm
by Vadi
Needed a way to see if my function was being called from an alias or a trigger context, came up with this. Not extensively tested yet, and would love better methods:
Code: [show] | [select all] lua
local debug = require "debug"; local t = debug.traceback()

if string.find(t, "Alias", 1, true) then echo("in an alias!")
elseif string.find(t, "Trigger", 1, true) then echo("in a trigger!")
else echo("dunno where.") end