| 13 | namespace Tutorial |
| 14 | { |
| 15 | public class CustomLoader : MonoBehaviour |
| 16 | { |
| 17 | LuaEnv luaenv = null; |
| 18 | // Use this for initialization |
| 19 | void Start() |
| 20 | { |
| 21 | luaenv = new LuaEnv(); |
| 22 | luaenv.AddLoader((ref string filename) => |
| 23 | { |
| 24 | if (filename == "InMemory") |
| 25 | { |
| 26 | string script = "return {ccc = 9999}"; |
| 27 | return System.Text.Encoding.UTF8.GetBytes(script); |
| 28 | } |
| 29 | return null; |
| 30 | }); |
| 31 | luaenv.DoString("print('InMemory.ccc=', require('InMemory').ccc)"); |
| 32 | } |
| 33 | |
| 34 | // Update is called once per frame |
| 35 | void Update() |
| 36 | { |
| 37 | if (luaenv != null) |
| 38 | { |
| 39 | luaenv.Tick(); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | void OnDestroy() |
| 44 | { |
| 45 | luaenv.Dispose(); |
| 46 | } |
| 47 | } |
| 48 | } |
nothing calls this directly
no outgoing calls
no test coverage detected