| 
				
				Sphinx.
								 
									Filter Optimizer								 
									  
								
				 | 
			
				
			I was going to continue work on a large script filter (mandelbulb renderer) in the newest filter forge release - now I get a new error I've never seen before:
 
Lua Critical Exception: Attempt to unpersist an external Lua function
 My script used to work - was something changed recently related to loading external script files? 				 
			 | 
		
			
		
			| Posted: February 22, 2011 10:16 am | 
			 
										Details
									E-Mail			
												
							 | 
	
			
			| 
				
				Sphinx.
								 
									Filter Optimizer								 
									  
								
				 | 
			
				
			I tried to look up the error on Google, but it seems to be Filter Forge specific - what does it mean? 				 
			 | 
		
			
		
			| Posted: February 23, 2011 4:48 am | 
			 
										Details
									E-Mail			
												
							 | 
	
			
			| 
				
				Sphinx.
								 
									Filter Optimizer								 
									  
								
				 | 
			
				
			Anyone? I can't seem to make any of my script filters with external references work due to this error    				 
			 | 
		
			
		
			| Posted: February 24, 2011 3:22 am | 
			 
										Details
									E-Mail			
												
							 | 
	
			
			| 
				
				Sphinx.
								 
									Filter Optimizer								 
									  
								
				 | 
			
				
			Ok - the error is not related to the initial include call:
 
in Map Script script I tried:
 | Code | 
|---|
 | dofile("C:\\Users\\Sphinx\\test.lua"); |   
where "test.lua" contains:
 | Code | 
|---|
 
 function prepare()
    -- This function is called once,
    -- before the rendering begins.
    -- Use it for querying non-mapped
    -- inputs and precalculation.
 end;
 
 function get_sample(x, y)
    -- Image generation code goes here.
    local r = x
    local g = y
    local b = (x + y) / 2
    local a = 1
    return r, g, b, a
 end;
  |   
This works just fine. I guess the error is related to actual script code in my external files. However the scripts used to work, so I need to know what that (new?) error message is about.. 				 
			 | 
		
			
		
			| Posted: February 24, 2011 3:57 am | 
			 
										Details
									E-Mail			
												
							 | 
	
			
			
				
				GMM
				 Moderator				
									Filter Forge, Inc								 
								
				
									Posts: 3493 
											  | 
			
				 
			So, the above script works? Please attach the one that doesn't work.				 
			 | 
		
			
		
			| Posted: February 24, 2011 4:36 am | 
			 
										Details
									E-Mail			
												
							 | 
	
			
			| 
				
				Sphinx.
								 
									Filter Optimizer								 
									  
								
				 | 
			
				
			I can't do that as the whole "application" use several lua libraries .. to much to set up for a simple test case.
 
I just want to know what triggers that error message in general (and what it means.. "unpersist" is not very clear to me). Then I can debug the actual problem myself... 				 
			 | 
		
			
		
			| Posted: February 24, 2011 5:17 am | 
			 
										Details
									E-Mail			
												
							 | 
	
			
			
				
				GMM
				 Moderator				
									Filter Forge, Inc								 
								
				
									Posts: 3493 
											  | 
			
				
			| Quote | 
|---|
 Sphinx. wrote:
 in the newest filter forge release |   
Could you let me know the exact FF build which started to show issues? (there have been different builds of 2.009 on the website).
 Now, a story about unpersisting. As you know rendering in Filter Forge is performed in separate passes. When you call prepare(), the Lua subsytem needs to save its results for future passes — for instance, if an unsafe script queries system time it should be consistent for all passes. We employ a third-party lib for that. In Lua jargon saving the result of a function is called persisting, and restoring the saved result is called unpersisting.
 I understand all of the above is of little help to debug your problem, but if you could set up a test base our developers promise to look into it   				 
			 | 
		
			
		
			| Posted: February 25, 2011 9:26 am | 
			 
										Details
									E-Mail			
												
							 | 
	
			
			| 
				
				Sphinx.
								 
									Filter Optimizer								 
									  
								
				 | 
			
				
			Alright I located the problem - it is related to a change in global variable visibility..
 
The testcase is rather simple:
 1. Create a new lua file, test.lua, with the following content:
 | Code | 
|---|
 
 function prepare()
    t = 1
 end;
 
 function get_sample(x, y)
    --t = 0.5
    return t,t,0,1
 end;
  |   
2. Create a new filter and drop a new Map Script, enter:
 | Code | 
|---|
 | dofile("C:\\test.lua") |   
Or the path to where you put the test.lua file (remember "\\" as directory delimiter format, e.g. "C:\\Users\\GMM\\test.lua"
 FF will now complain because global variable t is not registered properly (this used to work earlier).
 Comment out t assignment in prepare and enable t assignment in get_sample - now it works.
 The unpersist error is just a more complex version of this problem. I can send you a testcase for the unpersist error (I can't attach here due to file attachment restrictions), where should I send to? 				 
			 | 
		
			
		
			| Posted: February 26, 2011 6:01 am | 
			 
										Details
									E-Mail			
												
							 | 
	
			
			
				
				GMM
				 Moderator				
									Filter Forge, Inc								 
								
				
									Posts: 3493 
											  | 
			
				
			Thanks for the info, we'll look into it.
 
| Quote | 
|---|
 Sphinx. wrote:
 where should I send to |   
Please send to info@filterforge				  
			 | 
		
			
		
			| Posted: February 28, 2011 4:59 am | 
			 
										Details
									E-Mail			
												
							 | 
	
			
			| 
				
				Sphinx.
								 
									Filter Optimizer								 
									  
								
				 | 
			
				
			You should have a complete example in your inbox now    				 
			 | 
		
			
		
			| Posted: February 28, 2011 10:19 am | 
			 
										Details
									E-Mail			
												
							 | 
	
			
			| 
				
				Sphinx.
								 
									Filter Optimizer								 
									  
								
				 | 
			
				
			I'm still unpersisting my *** off here    Any news on the issue? 				 
			 | 
		
			
		
			| Posted: March 7, 2011 3:13 am | 
			 
										Details
									E-Mail			
												
							 | 
	
			
			
				
				GMM
				 Moderator				
									Filter Forge, Inc								 
								
				
									Posts: 3493 
											  | 
			
				
			The developers are still unpersisting your test case    We'll try to fix this by the release of the 3.0 beta.				  
			 | 
		
			
		
			| Posted: March 9, 2011 7:07 am | 
			 
										Details
									E-Mail			
												
							 | 
	
			
			| 
				
				Sphinx.
								 
									Filter Optimizer								 
									  
								
				 | 
			
				
			Just tested in FF3B1 .. bug is still there   				 
			 | 
		
			
		
			| Posted: May 3, 2011 7:38 am | 
			 
										Details
									E-Mail			
												
							 | 
	
			
			
				
				GMM
				 Moderator				
									Filter Forge, Inc								 
								
				
									Posts: 3493 
											  | 
			
				 
			Should be fixed in 5.011 – please check.				 
			 | 
		
			
		
			| Posted: September 19, 2016 9:55 am | 
			 
										Details
									E-Mail			
												
							 |