File tree Expand file tree Collapse file tree 3 files changed +3
-11
lines changed Expand file tree Collapse file tree 3 files changed +3
-11
lines changed Original file line number Diff line number Diff line change 27
27
// Below is an example usage of the library:
28
28
//
29
29
// import (
30
- // luajson "layeh .com/gopher-json"
30
+ // luajson "github .com/inbucket /gopher-json"
31
31
// )
32
32
//
33
33
// L := lua.NewState()
34
- // luajson.Preload(L )
34
+ // L.PreloadModule("json", luajson.Loader )
35
35
package json
Original file line number Diff line number Diff line change @@ -7,14 +7,6 @@ import (
7
7
"github.com/yuin/gopher-lua"
8
8
)
9
9
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
-
18
10
// Loader is the module loader function.
19
11
func Loader (L * lua.LState ) int {
20
12
t := L .NewTable ()
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ func TestSimple(t *testing.T) {
75
75
s := lua .NewState ()
76
76
defer s .Close ()
77
77
78
- Preload ( s )
78
+ s . PreloadModule ( "json" , Loader )
79
79
if err := s .DoString (str ); err != nil {
80
80
t .Error (err )
81
81
}
You can’t perform that action at this time.
0 commit comments