1 By using the `as` keyword, exports may be renamed when using the export 2 list syntax. It is also possible to specify string aliases which are not 3 valid variable names, in this case a rename on import is mandatory. 4 5 -- File test.uc -- 6 let testvar = 123; 7 const testconst = "Test"; 8 9 function testfunc() { 10 print("Hello, world!\n"); 11 } 12 13 export { testvar as modvar, testconst as 'define', testfunc as "module-function" }; 14 -- End -- 15 16 -- Testcase -- 17 import { modvar, define, "module-function" as func } from "./files/test.uc"; 18 19 print([ modvar, define, func ], "\n"); 20 -- End -- 21 22 -- Args -- 23 -R 24 -- End -- 25 26 -- Expect stdout -- 27 [ 123, "Test", "function testfunc() { ... }" ] 28 -- End --
This page was automatically generated by LXR 0.3.1. • OpenWrt