Fix error handling in Lua function run(). Made the samples use run() instead of dofile()
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1989 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
		
							parent
							
								
									b1f6a0329b
								
							
						
					
					
						commit
						f507cb7bcb
					
				@ -9,7 +9,7 @@
 | 
				
			|||||||
-- as published by the Free Software Foundation; version 2
 | 
					-- as published by the Free Software Foundation; version 2
 | 
				
			||||||
-- of the License. See <http://www.gnu.org/licenses/>
 | 
					-- of the License. See <http://www.gnu.org/licenses/>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dofile("../libs/dawnbringer_lib.lua")
 | 
					run("../libs/dawnbringer_lib.lua")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
OK,tin,clz,fade,amt,brikeep,falloff,nobg,briweight   = inputbox("Apply PenColor 2 Brush",
 | 
					OK,tin,clz,fade,amt,brikeep,falloff,nobg,briweight   = inputbox("Apply PenColor 2 Brush",
 | 
				
			||||||
                        
 | 
					                        
 | 
				
			||||||
 | 
				
			|||||||
@ -15,7 +15,7 @@
 | 
				
			|||||||
-- "-" (Num):   Zoom Out
 | 
					-- "-" (Num):   Zoom Out
 | 
				
			||||||
-- Esc:		Exit script
 | 
					-- Esc:		Exit script
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dofile("../libs/dawnbringer_lib.lua")
 | 
					run("../libs/dawnbringer_lib.lua")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
BRIDIAG_SHOW = 1     -- Show brightness/Grayscale diagonal (1 = on, 0 = off)
 | 
					BRIDIAG_SHOW = 1     -- Show brightness/Grayscale diagonal (1 = on, 0 = off)
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,7 @@
 | 
				
			|||||||
--Spare page holds data - Plays on current
 | 
					--Spare page holds data - Plays on current
 | 
				
			||||||
--by Richard Fhager
 | 
					--by Richard Fhager
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dofile("../libs/memory.lua")
 | 
					run("../libs/memory.lua")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
arg=memory.load({XS=16,YS=16,SPACE=1,FRAMES=8,XOFF=0,YOFF=0,FPS=10})
 | 
					arg=memory.load({XS=16,YS=16,SPACE=1,FRAMES=8,XOFF=0,YOFF=0,FPS=10})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -12,12 +12,10 @@
 | 
				
			|||||||
-- You may access these functions in your own scripts by loading this library,
 | 
					-- You may access these functions in your own scripts by loading this library,
 | 
				
			||||||
-- just add the follwing line as one of the first instructions:
 | 
					-- just add the follwing line as one of the first instructions:
 | 
				
			||||||
--
 | 
					--
 | 
				
			||||||
-- require("dawnbringer_lib")
 | 
					-- run("dawnbringer_lib")
 | 
				
			||||||
--
 | 
					 | 
				
			||||||
-- or
 | 
					 | 
				
			||||||
--
 | 
					 | 
				
			||||||
-- dofile("dawnbringer_lib.lua") 
 | 
					 | 
				
			||||||
--
 | 
					--
 | 
				
			||||||
 | 
					-- If the script is not in the same directory, use a relative path
 | 
				
			||||||
 | 
					-- like run("../libs/dawnbringer_lib.lua")
 | 
				
			||||||
--
 | 
					--
 | 
				
			||||||
-- Note that the functions must be called with the full library object-name, "db.function_name..."
 | 
					-- Note that the functions must be called with the full library object-name, "db.function_name..."
 | 
				
			||||||
--
 | 
					--
 | 
				
			||||||
 | 
				
			|||||||
@ -1432,9 +1432,9 @@ int L_Run(lua_State* L)
 | 
				
			|||||||
    // confusing than helpful.
 | 
					    // confusing than helpful.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (nb_args>0 && (message = lua_tostring(L, nb_args))!=NULL)
 | 
					    if (nb_args>0 && (message = lua_tostring(L, nb_args))!=NULL)
 | 
				
			||||||
      Verbose_message("Error running script", message);
 | 
					      return luaL_error(L, message);
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
      Warning_message("Unknown error running script!");
 | 
					      return luaL_error(L, "run: Unknown error running script!");
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  nested_calls--;
 | 
					  nested_calls--;
 | 
				
			||||||
  // restore directory
 | 
					  // restore directory
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user