Skip to content

Commit 1b32545

Browse files
authored
Remove unnecessary Preload function (#4)
Signed-off-by: James Hillyerd <[email protected]>
1 parent ee86713 commit 1b32545

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

doc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
// Below is an example usage of the library:
2828
//
2929
// import (
30-
// luajson "layeh.com/gopher-json"
30+
// luajson "github.com/inbucket/gopher-json"
3131
// )
3232
//
3333
// L := lua.NewState()
34-
// luajson.Preload(L)
34+
// L.PreloadModule("json", luajson.Loader)
3535
package json

json.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@ import (
77
"github.com/yuin/gopher-lua"
88
)
99

10-
// Preload adds json to the given Lua state's package.preload table. After it
11-
// has been preloaded, it can be loaded using require:
12-
//
13-
// local json = require("json")
14-
func Preload(L *lua.LState) {
15-
L.PreloadModule("json", Loader)
16-
}
17-
1810
// Loader is the module loader function.
1911
func Loader(L *lua.LState) int {
2012
t := L.NewTable()

json_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func TestSimple(t *testing.T) {
7575
s := lua.NewState()
7676
defer s.Close()
7777

78-
Preload(s)
78+
s.PreloadModule("json", Loader)
7979
if err := s.DoString(str); err != nil {
8080
t.Error(err)
8181
}

0 commit comments

Comments
 (0)