0

So I recently wrote a chat bot which relies on lua and luasocket to respond to a twitch stream's chat. It's very basic and has various files it reads/writes to. It runs from the local computer. I finally got it working perfectly and now I'm interested in potentially distributing it to streamers who would get the most practical usage out of it.

But I can't just give them the files and lua script; they wouldn't be able to run it. They would need an interpreter and they would need to set up luasocket. With very little experience this is a very daunting task. Even I struggled to properly get luasocket working to make this bot.

So my question: Is there a way to package the lua interpreter and luasocket library such that I can give my bot to other people in an easy to use and practical manner? Preferably a .exe file, but really anything that doesn't require them to go out and set up the entire language and script dependencies on their own.

warspyking
  • 3,045
  • 4
  • 20
  • 37
  • You could simply say "Unpack that .zip on your local computer and run RUNME.BAT". Is it not enough? – Egor Skriptunoff Apr 14 '18 at 06:57
  • @EgorSkriptunoff I'm not sure what you are trying to say. How would I set that up? – warspyking Apr 14 '18 at 07:17
  • (That would be perfectly fine instructions. But I'm not sure how I would package it so simply running the bat file would work. I have no experience doing this. My experience is limited to writing Lua scripts.) – warspyking Apr 14 '18 at 07:18
  • Place host program (lua.exe + lua.dll), library (luasocket.dll) and your script in the same folder. Write `lua.exe script.lua` in .bat file. – Egor Skriptunoff Apr 14 '18 at 09:19
  • @EgorSkriptunoff Just those 3 files? Does lua.exe and luasocket.dll not have it's own files it needs to depend on? If it's actually that simple I'll give it a go tomorrow I suppose. – warspyking Apr 14 '18 at 09:38
  • No, luasocket actually consists of [bunch of files](http://w3.impa.br/~diego/software/luasocket/installation.html). In .bat file you probably should modify LUA_PATH and LUA_CPATH env variables (or you could modify package.path and package.cpath from your script prior to require-ing luasocket library). – Egor Skriptunoff Apr 14 '18 at 10:12
  • @EgorSkriptunoff So lua.exe and lua.dll (that's it for lua) and the entire luasocket directory, and I change package.path and package.cpath in such a way that when I require the library it's able to find it? – warspyking Apr 14 '18 at 11:44
  • Yes, that should be enough – Egor Skriptunoff Apr 14 '18 at 12:09
  • It might be a bit overkill but you can also use something like Innosetup to create an installer but I guess Egor's way is sufficient – Piglet Apr 14 '18 at 19:34
  • @EgorSkriptunoff I can't seem to find lua.dll - does it go by a different name? – warspyking Apr 15 '18 at 02:41
  • Actually I figured it out. But I have way more files that just the few you mentioned. I have the entire lua binaries directory packed in with my project. – warspyking Apr 15 '18 at 05:39

0 Answers0