Login / Registrieren
DE EN FR ES IT CZ
Zurück Nach oben

Check object action exists (Lua Script)

  • #10, by Lebostein 11 years ago Zitieren
  • #11, by darren-beckett 11 years ago Zitieren
    All done -- I've added an error check:
    function objectActionExists(obj, actionName)
    local strActionName = "'" .. actionName .. "' executed"
    
    	if obj:isEmpty() then
    		print("Object is null")
    		return false
    	end
    
    	local act = obj.ObjectActions
    
    	-- iterate through the object list with a for loop...
    	for i = 1, #act do
    		if act[i]:getName() == strActionName then
    		    return true
    		end
    	end
    	return false
    end
    
  • #12, by afrlme 11 years ago Zitieren
    Nice one. wink