premake / premake-core

Premake
https://premake.github.io/
BSD 3-Clause "New" or "Revised" License
3.22k stars 620 forks source link

LuaJIT and Lua5.1 #1120

Closed sonoro1234 closed 5 years ago

sonoro1234 commented 6 years ago

Hi,

For all the people using LuaJIT, Lua stops at 5.1 (and some 5.2 in compatibility mode) I dont miss anything from later Lua versions and they leave me without LuaJIT power. So these are my reasons for not jumping from CMake to Premake. Is there any chance to support 5.1 Lua version? Is there a reason for not using it?

Best victor bombi

tvandijck commented 6 years ago

There is a few features we use from Lua 5.3 yes, but no it's not a requirement, and those things can probably be 'converted' to be 5.1 compatible... In fact, I've tried LuaJIT a few times.

However, LuaJIT provides absolutely no benefit to premake. Premake is just moving a lot of memory around and doing lots and lots of table modifications. LuaJIT seems to do very little to optimize that. It's basically not the Lua VM that is in the way of performance in Premake.

I find it a somewhat odd reason to dismiss Premake because of it in favor of CMake, I can think of many other reasons to go with one or the other. But I'm sure you have a very good reason to require LuaJIT, I'm curious what that reason is other then the perceived performance benefit.

sonoro1234 commented 6 years ago

I did not mean using LuaJIT in premake but just Lua 5.1. Because being a LuaJIT user makes all my Lua code to be 5.1 compatible.

(As for the performance of LuaJIT in premake I would be quite surprised if it were worst than plain Lua)

tvandijck commented 6 years ago

But your code and the code premake uses are completely independent... You can write Lua 5.1 code as much as you like. That doesn't mean Premake has to use Lua 5.1 internally as well right? Premake embeds its own lua vm into the premake binary, and does not use the lua interpreter installed on your system. It doesn't create a lua.dll or .so, or anything like that, it's all statically linked into the premake executable.

So I don't understand what your code and Premake have to do with each other? Are you planning on running your lua code using the Premake VM ?

Feel free to submit a PR with a downgrade and we can discuss the merits of those changes further in there, but so far I'm confused as to why?

This is the PR where we updated from 5.1 to 5.3.4 https://github.com/premake/premake-core/pull/804

sonoro1234 commented 6 years ago

Are you planning on running your lua code using the Premake VM ? Yes, that was the plan. I will take a look at #804

tvandijck commented 6 years ago

That is even more confusing? why? Premake is a buildsystem to generate visual studio projects and makefiles... Why would you want to run all your other software in that system? Wouldn't it be easier to just run lua/luajit and run your code? And let Premake be a buildsystem?

I am so confused, do you have any examples of what you want to achieve?

sonoro1234 commented 6 years ago

I have made a script for doing a ffi binding from a C++ library: Generate C files, get struct, enums and function information to automatically generate the C and LuaJIT code. I would like to also build with Premake and mingw in the same task

starwing commented 6 years ago

If you only want using premake's vm generate the C and LuaJIT code, why it must be 5.1?

sonoro1234 commented 6 years ago

Because Lua 5.3 may be not compatible with my scripts (without me even know it)

samsinsane commented 6 years ago

I appreciate the position that you're in, and I wish we could help but all of your reasons for not rewriting your scripts are the same reasons we're going to have for not changing our Lua version.

Have you considered creating a binary module that contains a LuaJIT VM? You can see examples of binary modules in the binmodules folder.

samsinsane commented 5 years ago

I'm going to close this issue, if you wish to continue discussing it please feel free to reopen.