lua - LUA_INIT environment variable not working -
i'm quite new lua language , i'm trying different things. manual said before interpreter start, looks environment variable lua_init , if has form of @filename, interpreter run file filename first. 
i'm using ubuntu, after tried define lua_init variable @/home/tontyoutoure/lua/lua_init.lua, in write simple function, returns factorial of natural number:
function fact(n)     if n == 0         return 1     else         return n*fact(n-1)     end end   i checked variable, , seems alright:
$ echo $lua_init @/home/tontyoutoure/lua/lua_init.lua   i suppose interpreter should load function fact first, when start interpreter , make simple test:
$ lua > = fact(5) stdin:1: attempt call global 'fact' (a nil value) stack traceback:     stdin:1: in main chunk     [c]: in ?   it seems me interpreter did not load file. part did wrong?
 
 
  
Comments
Post a Comment