mirror of
				https://github.com/sammy-ette/Hilbish
				synced 2025-08-10 02:52:03 +00:00 
			
		
		
		
	feat: add goro function
this function will run another function, but in a goroutine !!
This commit is contained in:
		
							parent
							
								
									9defa737f4
								
							
						
					
					
						commit
						c1b9e5bc81
					
				
							
								
								
									
										6
									
								
								lua.go
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								lua.go
									
									
									
									
									
								
							| @ -12,6 +12,7 @@ import ( | ||||
| 	"hilbish/golibs/fs" | ||||
| 
 | ||||
| 	"github.com/yuin/gopher-lua" | ||||
| 	"layeh.com/gopher-luar" | ||||
| ) | ||||
| 
 | ||||
| var minimalconf = ` | ||||
| @ -30,6 +31,7 @@ func LuaInit() { | ||||
| 	l.SetGlobal("alias", l.NewFunction(hshalias)) | ||||
| 	l.SetGlobal("appendPath", l.NewFunction(hshappendPath)) | ||||
| 	l.SetGlobal("exec", l.NewFunction(hshexec)) | ||||
| 	l.SetGlobal("goro", luar.New(l, hshgoroutine)) | ||||
| 
 | ||||
| 	// yes this is stupid, i know | ||||
| 	l.PreloadModule("hilbish", HilbishLoader) | ||||
| @ -151,3 +153,7 @@ func hshexec(L *lua.LState) int { | ||||
| 	syscall.Exec(cmdPath, cmdArgs, os.Environ()) | ||||
| 	return 0 // random thought: does this ever return? | ||||
| } | ||||
| 
 | ||||
| func hshgoroutine(gofunc func()) { | ||||
| 	go gofunc() | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user