MCPcopy Index your code
hub / github.com/Shopify/go-lua / FileResult

Function FileResult

auxiliary.go:560–573  ·  view source on GitHub ↗

FileResult produces the return values for file-related functions in the standard library (io.open, os.rename, file:seek, etc.).

(l *State, err error, filename string)

Source from the content-addressed store, hash-verified

558// FileResult produces the return values for file-related functions in the standard
559// library (io.open, os.rename, file:seek, etc.).
560func FileResult(l *State, err error, filename string) int {
561 if err == nil {
562 l.PushBoolean(true)
563 return 1
564 }
565 l.PushNil()
566 if filename != "" {
567 l.PushString(filename + ": " + err.Error())
568 } else {
569 l.PushString(err.Error())
570 }
571 l.PushInteger(0) // TODO map err to errno
572 return 3
573}
574
575// DoFile loads and runs the given file.
576func DoFile(l *State, fileName string) error {

Callers 5

newFileFunction · 0.85
writeFunction · 0.85
readFunction · 0.85
io.goFile · 0.85
os.goFile · 0.85

Calls 5

PushBooleanMethod · 0.80
PushNilMethod · 0.80
PushStringMethod · 0.80
PushIntegerMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected