Run pure lua programs

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Murii
Party member
Posts: 216
Joined: Fri Jul 05, 2013 9:58 am
Location: Arad, Romania
Contact:

Run pure lua programs

Post 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!
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: Run pure lua programs

Post 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
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
Murii
Party member
Posts: 216
Joined: Fri Jul 05, 2013 9:58 am
Location: Arad, Romania
Contact:

Re: Run pure lua programs

Post by Murii »

thx for the tip!!!
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Run pure lua programs

Post 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)
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
電波
Prole
Posts: 1
Joined: Thu Nov 06, 2014 4:28 am

Re: Run pure lua programs

Post 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/
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: Run pure lua programs

Post 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
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Run pure lua programs

Post 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
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 0 guests