How to install Lua libraries on separate folder - lua

Hello i would like to change folder that luasocket is installing to how can i do that ? My plan is at the end i want to export my lua file as exe and use it to run my server. I want to put luasocket inside Project file so other windows computer wont have problems (I am using Windows computer too). Thanks for helping.
my code
Main.lua
lpackage.path = package.path..';./libs/lua/?.lua'
package.cpath = package.cpath..';./libs/socket/?.dll;'
This is my Project tree
Project
-libs
--lua

Assuming you keep the name of the luasocket DLL the same (which is usually, core.dll), you need to use ./libs/?.dll instead of ./libs/socket/?.dll, as the question mark will be replaced with socket/core when socket.core module is required from socket.lua. You'll need to put core.dll in libs/socket folder.
You will also need to have lua.dll present (as the core.dll is usually compiled against it) or use a proxy dll if your executable statically compiles lua interpreter.

Related

'socket.http' DLLs aren't found when Lua is compiled

I've started to really get into using Lua, and a few months ago I've figured out on how to turn .lua files into executables.
It's been working great so far, until I started to compile lua scripts that use 'socket.http'. It seems to be missing some DLLs of some sort, and I don't know how I would be able to add them into the same folder.
Where would I find these such DLLs to add into the same folder of my executable, so that I could be able to run Lua executables using socket.http?
socket.http module doesn't come as DLL; it comes as a pure-lua module. Usually there is socket.lua and socket\http.lua files (as well as socket\core.dll), so you'd need to package all of them and make them available to your script to make it work.
You can find the Lua files in the luasocket repository, but make sure that they match the API for the binaries (socket/core.* files) you are using.

How to install lmapm for lua?

I am making a script that requires lmapm, but I'm not quite sure how to install it. I have 4 files,
lmapm.c
test.lua
README
Makefile
And I'm not sure how to use them in my lua environment. Lua 5.1 is installed on my desktop in a folder called "5.1", and it was installed with LuaRocks (If that matters) I know lua libraries are used with require, but this is a c file, not a lua file.
How can I install/use lmapm in my lua programs?
Upon reading the readme it tells me to run make, but makefile is just a "file" on my computer, there is nothing I can run it with.
README: Short description of what you got and how to install & use the module at the end.
test.lua: Lua script to test the module/sample of usage.
lmapm.c: C source code and the module in raw/still unusable form. Needs to get compiled and linked to a dynamic library of target platform.
Makefile: Automatic build instructions to compile&link lmapm.c to what you finally use in Lua.
Makefile serves as a macro which makes building easier with minimal input by users. To run this file, you need program make (comes with GNU toolchain; on Unix install package build-essential, on Windows MSYS). Before you have to fix the path to your Lua and MAPM installation (as mentioned in the official build instructions). Furthermore you need the C compiler and linker (which you already installed on Unix together with make and have to install on Windows by f.e. MinGW).
The result is a dynamic library/Lua C module which you can require simply by its filename. To put it in the scope of Lua, move it in the application or (better) in the Lua modules directory.

Lua 5.2 adding luasocket (unstable)

Im trying to use luasocket with lua 5.2. i downloaded the code form the git repository and built it. then made a make install so that it generated core.dll and mime.dll. put those into the custom lua program directory [CPATH] im developing and tried loading it. But i get following error message:
Failed at error loading module 'socket.core' from file 'D:\[..myprogram..]\socket\core.dll':
Module was not found.
how can i check if the dll is correct. or did i do anything wrong?
Thanks
Is your executable residing in the same directory as your lua files?
Try putting the dll in the directory of your executable.
Most likely you are loading socket modules that are compiled for Lua 5.1, not Lua 5.2 (or at least it's the same error I get in a case like that). Is it possible that you have socket module for Lua 5.1 somewhere in your path? It may come with LuaForWindows or another package. You can try to remove/move the socket DLLs you compiled (for Lua 5.2) and see if you get the same error.

Compiling an .SWF using Action Script Files

This may be somewhat trivial, but I am attempting to work on an Action Script / Flash project and need to make some changes to it and attempt to rebuild the .SWF file associated with it.
The project itself is fairly straightforward and is available on github here It is jwagener's recorder.js, which consists of several Action Script files and a single compiled .SWF file.
I am not terribly familiar with the build process for Action Scripts and I am sure that I have all of the necessary tools (Flash Builder, Adobe Flash Professional etc.) but I am not sure about how to go about it.
I've attempted to simply create a new ActionScript project and add all of the necessary ActionScript files from his repository, but upon building the .SWF it didn't function at all and lacked all of the External Interface elements that I need to use.
Any ideas, walk-throughs, or tutorials that would point me in the right direction would be extraordinarily helpful.
The project you want to compile actually includes a Make file.
MXMLC = "/Applications/Adobe Flash Builder 4.5/sdks/4.5.0/bin/mxmlc"
build:
$(MXMLC) -debug=false -static-link-runtime-shared-libraries=true -optimize=true -o recorder.swf -file-specs flash/FlashRecorder.as
clean:
rm recorder.swf
It looks setup for osx, but you get the idea.
If you only need to do minor changes and could do without an IDE that shows error/warnings/etc. you can do this:
Download the FlexSDK
Setup an environment variable so you can access the mxmlc compiler from anywhere on your system
Navigate to your project and compile from the command line
Step 1 is trivial.
Step 2 depends on your os a bit. On Windows should be something like My Computer > Properties > Advanced > Environment variables (I remember this is on XP, should still be somewhere on the Computer Properties properties on Windows 7) and add to the PATH variable the location of the FlexSDK's bin folder. On unix you should add something like this to either ~/.profile or ~/.bash_profile : export PATH=/your/path/to/FlexSDK/bin:$PATH
At this you should be able to run mxmlc -version from the command line
Step 3 means navigating to the project and running:
mxmlc -warnings=false -debug=false -static-link-runtime-shared-libraries=true -optimize=true -o recorder.swf -file-specs flash/FlashRecorder.as
So that's the command line option in a nutshell.
If you have a bit more editing to do you can use an IDE.
If you're on Windows I warmly recommend FlashDevelop: it's fast/lightweight/free/opensource. It downloads the sdk and setups everything for you.
If you're on OSX you can use FDT 5 Free or a trial version of Flash Builder(60 days by default) or setup TextMate with the actionscript 3 bundle.

Can i run Erlang without local admin rights on Windows?

I have a machine which doesn't give me local admin rights. Is it still possible to run erlang on it, as I cannot run a windows .exe installer to install erlang?
You can copy erl.exe (plus the runtime system and all the libraries you need) from another installation and run it without the need to install. As long as you are allowed to execute files it should be okay.
Forgive me for not being as smart as Zubair,
but I would like to know exactly how to do this.
I do not have admin privilege, cannot run installers, and cannot copy files to C:\WINDOWS.
In particular, I cannot write to C:\WINDOWS\WinSxS or C:\WINDOWS\system32.
How do I get a list of exactly what libraries are required by the various erlang executables ?
I have all the MS redistributable libraries and manifests,
but I don't know where to put them to make it work.
The redistributable library structure has directories such as
Microsoft.VC90.ATL, Microsoft.VC90.CRT, etc. Each directory contains relevant dlls and a manifest.
Do I copy all the contents into the ERL_HOME\bin directory or ERL_HOME\erts-x.y.z\bin or ERL_HOME\erts-x.y.z\lib ?
or leave them in some other directory and put those entries in the PATH ?
or do I need to build the paths implied by the manifests (i.e. where they would be copied into the WinSxS cache) using hashes and version numbers in the paths, then put those entries in the PATH ?

Resources