Documentation ¶
Overview ¶
Package goos implements golang package os functionality for lua.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Getpagesize ¶
Getpagesize lua goos.pagesize() return number
Example ¶
goos.get_pagesize()
state := lua.NewState() Preload(state) inspect.Preload(state) source := ` local goos = require("goos") local page_size = goos.get_pagesize() print(page_size > 0) ` if err := state.DoString(source); err != nil { log.Fatal(err.Error()) }
Output: true
func Hostname ¶
Hostname lua goos.hostname() returns (string, error)
Example ¶
goos.hostname()
state := lua.NewState() Preload(state) inspect.Preload(state) source := ` local goos = require("goos") local hostname, err = goos.hostname() if err then error(err) end print(hostname > "") ` if err := state.DoString(source); err != nil { log.Fatal(err.Error()) }
Output: true
func MkdirAll ¶
MkdirAll lua goos.mkdir_all() return err
Example ¶
goos.mkdir_all()
state := lua.NewState() Preload(state) inspect.Preload(state) source := ` local goos = require("goos") local err = goos.mkdir_all("./test/test_dir_example/test_dir") if err then error(err) end local _, err = goos.stat("./test/test_dir_example/test_dir") print(err == nil) ` if err := state.DoString(source); err != nil { log.Fatal(err.Error()) }
Output: true
func Preload ¶
Preload adds goos to the given Lua state's package.preload table. After it has been preloaded, it can be loaded using require:
local goos = require("goos")
func Stat ¶
Stat lua goos.stat(filename) returns (table, err)
Example ¶
goos.stat(filename)
state := lua.NewState() Preload(state) inspect.Preload(state) source := ` local goos = require("goos") local inspect = require("inspect") local info, err = goos.stat("./test/test.file") if err then error(err) end info.mode="" info.mod_time=0 print(inspect(info, {newline="", indent=""})) ` if err := state.DoString(source); err != nil { log.Fatal(err.Error()) }
Output: {is_dir = false,mod_time = 0,mode = "",size = 0}
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.