Guest User

Untitled

a guest
Jul 20th, 2018
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.19 KB | None | 0 0
  1. #!../lua/bin/lua
  2.  
  3. -- Set libraries up
  4. package.path = package.path .. ';./lib/?.lua';
  5. package.cpath = package.cpath .. ';./lib/?.dll;./lib/?.so;';
  6. -- print("LUA MODULES:\n",(package.path:gsub("%;","\n\t")),"\n\nC MODULES:\n",(package.cpath:gsub("%;","\n\t")))
  7. libluaph  = require 'libluaph1'
  8. url       = require "url"
  9. inifile   = require "inifile"
  10. pprint    = require "pprint"
  11. require "lib" -- our main functions will be imported into the global namespace
  12.  
  13. -- globals ---------------------------------------------------------------------
  14. log        = nil -- file handle for log file
  15. log_buffer = ""  -- string buffer, holds log data until we can open the log file
  16. -- ... a bunch of other globals
  17.  
  18. if OS == nil then OS = "Linux" end -- change this when debugging outside the C wrapper to your environment
  19.  
  20. --[[
  21. find the directory of the current executable
  22.     make sure to handle the scripting environment as well as the
  23.     compiled C file propperly
  24.    
  25.     set the base directory as environment variable PH_HOME 
  26. ]]--
  27. PH_HOME = basename(libluaph.realpath(arg[0]))
  28. print("PH_HOME: ", PH_HOME)
  29. libluaph.setenv("PH_HOME", PH_HOME);
  30. print(os.getenv("PH_HOME"))
  31. print(libluaph.getenv("PH_HOME"))
  32. os.exit(0)
Advertisement
Add Comment
Please, Sign In to add comment