()
| 86 | } |
| 87 | |
| 88 | func ExampleLuaOptions_enableModules() { |
| 89 | runExampleWithOptions( |
| 90 | LuaOptions{ |
| 91 | Modules: []string{ |
| 92 | "base._G", "base.pairs", "base.ipairs", "base.print", "base.require", |
| 93 | "table.sort", "table.insert", |
| 94 | // enable all symbols from "package" module as |
| 95 | // additional preloaded modules require it |
| 96 | "package", |
| 97 | // preload additional module |
| 98 | "base64", |
| 99 | }, |
| 100 | }, |
| 101 | testScript(printTable+` |
| 102 | local base64 = require("base64") |
| 103 | |
| 104 | function request() |
| 105 | printTable("", _G) |
| 106 | printTable("table.", table) |
| 107 | printTable("package.", package) |
| 108 | printTable("package.preload.", package.preload) |
| 109 | end |
| 110 | `), |
| 111 | ) |
| 112 | // Output: |
| 113 | // _G |
| 114 | // ipairs |
| 115 | // package |
| 116 | // pairs |
| 117 | |
| 118 | // printTable |
| 119 | // request |
| 120 | // require |
| 121 | // table |
| 122 | // table.insert |
| 123 | // table.sort |
| 124 | // package.config |
| 125 | // package.cpath |
| 126 | // package.loaded |
| 127 | // package.loaders |
| 128 | // package.loadlib |
| 129 | // package.path |
| 130 | // package.preload |
| 131 | // package.seeall |
| 132 | // package.preload.base64 |
| 133 | } |
| 134 | |
| 135 | func ExampleLuaOptions_disableAll() { |
| 136 | runExampleWithOptions( |
nothing calls this directly
no test coverage detected
searching dependent graphs…