added _main

This commit is contained in:
Luxferre
2026-07-04 09:30:02 +03:00
parent ce18aa76b5
commit 0beaa27fe7
3 changed files with 12 additions and 4 deletions
+5 -1
View File
@@ -460,5 +460,9 @@ func RunFile(filePath string, libCode string) {
defer func() {
if r := recover(); r != nil { fmt.Fprintf(os.Stderr, "Error executing %s: %v\n", filePath, r); os.Exit(1) }
}()
NewClyx("", libCode).Run(string(content))
c := NewClyx("", libCode)
c.Run(string(content))
if c.HasWord("_main") {
c.Run("_main")
}
}