Thanks for posting, and sorry for not getting back to you earlier. Using some tricks with the .last function in the Alias table, you can parse through a dataport's history. By setting the .last to an arbitrary point in time(that has passed), you can 'wait' from then to the present.
In practice this process looks like this:
local period = 60 -- how far you want to look back in seconds
local start_time = now-period
local end_time = now
local function evaluateHistory(p_start,p_end)
local done = false
mydataport.last = p_start
while done == false do
local ts = mydataport.wait(p_end)
-- you can use mydataport[ts] to interact with data that is in the 'past'.
This is the general method of getting this done. But my understanding is that you are looking to recreate event functionality, so I made an example script that you can use. This Lua script sends an alert via email if a given dataport's value is above 100.
For more details about Lua scripting please visit: http://docs.exosite.com/scripting/
Feel free to post back if you have questions!