Page 1 of 1

Run pure lua programs

Posted: Wed Nov 05, 2014 5:32 pm
by Murii
Hey,how do I run a .lua file whitout love?And what if i want to make .exe from it,how`s that possible?Thanks!

Re: Run pure lua programs

Posted: Wed Nov 05, 2014 6:35 pm
by Positive07
Google "lua for windows"... it allows you to run pure lua files. Not sure about how to make an .exe though

OTHER OPTION:

You could call your lua file main.lua, and add a conf.lua file with the following code

Code: Select all

love.conf = function (t)
    t.console = true
    t.window.width = 0               -- The window width (number)
    t.window.height = 0              -- The window height (number)
    t.modules.graphics = false          -- Enable the graphics module (boolean)
    t.modules.window = false            -- Enable the window module (boolean)
end
You must not define love.load, love.update or love.draw in you code or else the magic wont happen (love.graphics wont work so dont call it either)...

Then you can pack all your files in a .love file and then make an exe

It should work as you want... try it and tell me

Re: Run pure lua programs

Posted: Wed Nov 05, 2014 8:11 pm
by Murii
thx for the tip!!!

Re: Run pure lua programs

Posted: Wed Nov 05, 2014 11:19 pm
by zorg
or you could do t.window = false in your conf, so it's not even initialized... OR even better, just set the window module to false, so it's not even loaded. (i -think- it's not needed for a console on win, and on other OSes, it interfaces with the proper console anyway)

Re: Run pure lua programs

Posted: Thu Nov 06, 2014 4:42 am
by 電波
To create self-running Lua programs, use srlua: https://github.com/LuaDist/srlua

To run Lua files without LÖVE, download the Lua source code: http://www.lua.org/ftp/

Then compile it to get the Lua interpreter.

If you want to try it out without jumping through fiery hoops, then go here: http://joedf.users.sourceforge.net/luabuilds/

Re: Run pure lua programs

Posted: Thu Nov 06, 2014 4:21 pm
by Positive07
zorg wrote:or you could do t.window = false in your conf, so it's not even initialized... OR even better, just set the window module to false, so it's not even loaded. (i -think- it's not needed for a console on win, and on other OSes, it interfaces with the proper console anyway)
Yeah that is what I said, but console is needed if you want to see a console (at least in windows) since he wants an .exe. That means he doesnt want to run it from a console but from a file
so yeah the two key lines in conf are:

Code: Select all

t.console = true
t.modules.window = false

Re: Run pure lua programs

Posted: Thu Nov 06, 2014 8:44 pm
by zorg
agreed, i did not actually state that he should set console to false, just that i wasn't sure whether window was needed for the console window or not; guess not then! :3