mirror of https://github.com/Hilbis/Hilbish
Compare commits
1 Commits
8038136e8a
...
ff097ba3a9
Author | SHA1 | Date |
---|---|---|
sammyette | ff097ba3a9 |
1
api.go
1
api.go
|
@ -37,7 +37,6 @@ import (
|
||||||
var hshMod *moonlight.Table
|
var hshMod *moonlight.Table
|
||||||
|
|
||||||
func hilbishLoader(mlr *moonlight.Runtime) moonlight.Value {
|
func hilbishLoader(mlr *moonlight.Runtime) moonlight.Value {
|
||||||
println("hilbish loader called")
|
|
||||||
var exports = map[string]moonlight.Export{
|
var exports = map[string]moonlight.Export{
|
||||||
"alias": {hlalias, 2, false},
|
"alias": {hlalias, 2, false},
|
||||||
"appendPath": {hlappendPath, 1, false},
|
"appendPath": {hlappendPath, 1, false},
|
||||||
|
|
2
lua.go
2
lua.go
|
@ -52,7 +52,7 @@ func luaInit() {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Add more paths that Lua can require from
|
// Add more paths that Lua can require from
|
||||||
_, err := l.DoString("print(type(hilbish)); package.path = package.path .. " + requirePaths)
|
_, err := l.DoString("package.path = package.path .. " + requirePaths)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, err)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
fmt.Fprintln(os.Stderr, "Could not add Hilbish require paths! Libraries will be missing. This shouldn't happen.")
|
fmt.Fprintln(os.Stderr, "Could not add Hilbish require paths! Libraries will be missing. This shouldn't happen.")
|
||||||
|
|
|
@ -15,7 +15,7 @@ func (mlr *Runtime) LoadLibrary(ldr Loader, name string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
mlr.state.GetGlobal("package")
|
mlr.state.GetGlobal("package")
|
||||||
mlr.state.GetField(-1, "loaded")
|
mlr.state.GetField(-1, "preload")
|
||||||
mlr.state.PushGoFunction(cluaLoader)
|
mlr.state.PushGoFunction(cluaLoader)
|
||||||
mlr.state.SetField(-2, name)
|
mlr.state.SetField(-2, name)
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,3 @@ func ToTable(v Value) *Table {
|
||||||
func TryTable(v Value) (*Table, bool) {
|
func TryTable(v Value) (*Table, bool) {
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Table) setRefIdx(mlr *Runtime, i idx) {
|
|
||||||
t.refIdx = mlr.state.Ref(i)
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,6 +8,5 @@ func (mlr *Runtime) DoString(code string) (Value, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mlr *Runtime) DoFile(filename string) error {
|
func (mlr *Runtime) DoFile(filename string) error {
|
||||||
//return mlr.state.DoFile(filename)
|
return mlr.state.DoFile(filename)
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ commander.register('cd', function (args, sinks)
|
||||||
dirs.setOld(hilbish.cwd())
|
dirs.setOld(hilbish.cwd())
|
||||||
dirs.push(path)
|
dirs.push(path)
|
||||||
|
|
||||||
local ok, err = pcall(function() fs.cd(fs.abs(path)) end)
|
local ok, err = pcall(function() fs.cd(path) end)
|
||||||
if not ok then
|
if not ok then
|
||||||
sinks.out:writeln(err)
|
sinks.out:writeln(err)
|
||||||
return 1
|
return 1
|
||||||
|
|
|
@ -27,7 +27,7 @@ hilbish.tips = {
|
||||||
}
|
}
|
||||||
|
|
||||||
bait.catch('hilbish.init', function()
|
bait.catch('hilbish.init', function()
|
||||||
if hilbish.interactive and hilbish.opts.tips then
|
if hilbish.interactive and hilbish.opts.tip then
|
||||||
local idx = math.random(1, #hilbish.tips)
|
local idx = math.random(1, #hilbish.tips)
|
||||||
print(lunacolors.format(PREAMBLE .. "\nTip: " .. hilbish.tips[idx]))
|
print(lunacolors.format(PREAMBLE .. "\nTip: " .. hilbish.tips[idx]))
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue