StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Register | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Lua Scripts
 Action Scripts Using Alien
 Environment Variables
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

plunt

Italy
88 Posts

Posted - 12/30/2012 :  06:39:41  Show Profile  Reply with Quote
I use this simple function to get system variables as TMP or ProgramFiles.
It would be useful to implement it directly in the program?

function Env(var)
	local eev = kernel32.ExpandEnvironmentStringsA
	eev:types{ ret = "long", abi = 'stdcall', "string", "pointer", "long" }
	local buffer = aliencore.buffer(512)
	eev("%" .. var .. "%", buffer, 512)
	return tostring(buffer)
end

Rob

USA
2604 Posts

Posted - 12/30/2012 :  16:23:34  Show Profile  Visit Rob's Homepage  Reply with Quote
Actually I think it will be good to provide folks with a .lua file which includes a bunch of functions that people have come up with. The reason I built Alien and Lua into S+ was so people could add functionality without needing a new version to be released.

There's really no reason to build this into S+ as it works fine here. If eev was defined in Global Lua (instead of being instantiated for each call to Env), it's not really much different than if it were built-in.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000