1 A file or a string that the body of a dynamically loaded module loads is a 2 program of its own, not a module: it can return a value. 3 4 -- Testcase -- 5 let loader = import("loader"); 6 7 print("file: ", loader.file(), "\n"); 8 print("string: ", loader.string(), "\n"); 9 -- End -- 10 11 -- File loader.uc -- 12 export const file = loadfile("files/script.uc"); 13 export const string = loadstring("return 2;\n"); 14 -- End -- 15 16 -- File script.uc -- 17 return 1; 18 -- End -- 19 20 -- Args -- 21 -R -L files/ 22 -- End -- 23 24 -- Expect stdout -- 25 file: 1 26 string: 2 27 -- End --
This page was automatically generated by LXR 0.3.1. • OpenWrt