-- Hi from a newbie!

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

-- Hi from a newbie!

Clinton Reese
--[[


I'm truly a Lua newbie. I'm such a newbie that I don't know if asking newbie questions on this email stream is wasting everyone's precious time. If so, feel free to close this message immediately!

I love the language and think Dr. Roberto Ierusalimschy is a genius, though, because I think that minimalism is the key to reliability in human designs. Plus I think designing a teaching system for a programming language around some aspects of the moon is way cool, and even wise
.
Specifically, right now, I'm trying to compile the Lua 5.3 code from source, on Windows 10, using Visual Studio 2019.

Is that my first mistake? Yeah, I attempt bad humor. I seem to be over my head with these feature-bloated IDE's designed to build and support feature-bloated programs. Perhaps I should switch to Linux or Minix for development.

I copied and pasted the Lua 5.3 source from the website into source files manually. Scripting wizard I ain't. I tried to combine the code with code from:

Specifically:

#include <stdio.h>
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
/* the Lua interpreter */
lua_State* L;
int main ( int argc, char *argv[] )
{
        /* initialize Lua */
        L = lua_open();
        /* load various Lua libraries */
        lua_baselibopen(L);
        luaopen_table(L);
        luaopen_io(L);
        luaopen_string(L);
        luaopen_math(L);
   
        /* cleanup Lua */
        lua_close(L);
        return 0;
}

I got some kind of error about C++ not allowing default-int, I believe.

So, I manually saved the .c files with .cpp files.
Less errors, but I couldn't even seem to find the executable to run it! Comedic!

OK. I tried a new approach:

1. Open new project from existing code
2. Visual C++
3. ProjectFileLocation: C:\Users\cbruc\Desktop\CandLua\10-8-2019
4. Project Name: MoonShine53
5. Add files to the project from these folders: C:\Users\cbruc\Desktop\CandLua\10-8-2019 C:\Users\cbruc\Desktop\Lua53Source (Files with .c extension, not .cpp, yet)
6. Show all files in Solution Explorer
7. Finish

Well, I thought I did this before and got a long list of similar error messages, but now I'm getting the windows-processing-twirly-thing for over 16 minutes.

Thanks in advance for your time.

Thanks,

Clint Reese
 
--]] -- P.S.: My first Lua program shared with the email list!

print("Thanks again!")

Reply | Threaded
Open this post in threaded view
|

Re: -- Hi from a newbie!

Jonathan Goble
On Wed, Oct 23, 2019, 8:15 AM Clinton Reese <[hidden email]> wrote:
--[[


I'm truly a Lua newbie. I'm such a newbie that I don't know if asking newbie questions on this email stream is wasting everyone's precious time. If so, feel free to close this message immediately!

Welcome! It is absolutely not a waste of time. This list gets everything from basic newbie questions to deep philosophical and technical discussions about the future of Lua.

Specifically, right now, I'm trying to compile the Lua 5.3 code from source, on Windows 10, using Visual Studio 2019.

Is that my first mistake? Yeah, I attempt bad humor. I seem to be over my head with these feature-bloated IDE's designed to build and support feature-bloated programs. Perhaps I should switch to Linux or Minix for development.

Indeed, Lua is set up for compiling in Linux, Unix, or a similar environment with similar tools. It is not equipped out of the box to be compiled with Visual Studio. 

I copied and pasted the Lua 5.3 source from the website into source files manually.

Stop there. Don't do that. *playful smack* :-P

You should instead download the tarball from https://www.lua.org/download.html and use a tool like 7-Zip to open and extract it. 

Scripting wizard I ain't. I tried to combine the code with code from:

Specifically:

#include <stdio.h>
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
/* the Lua interpreter */
lua_State* L;
int main ( int argc, char *argv[] )
{
        /* initialize Lua */
        L = lua_open();
        /* load various Lua libraries */
        lua_baselibopen(L);
        luaopen_table(L);
        luaopen_io(L);
        luaopen_string(L);
        luaopen_math(L);
   
        /* cleanup Lua */
        lua_close(L);
        return 0;
}

You don't need anything like this if you just want the stand-alone interpreter. lua.c already handles it for that case. 

I got some kind of error about C++ not allowing default-int, I believe.

So, I manually saved the .c files with .cpp files.

Visual Studio is designed for C++, and although .c files will be compiled as C, the interface and some error messages still say C++. That said, stock Lua can be cleanly compiled as C++ unmodified as well. 

Less errors, but I couldn't even seem to find the executable to run it! Comedic!

OK. I tried a new approach:

1. Open new project from existing code
2. Visual C++
3. ProjectFileLocation: C:\Users\cbruc\Desktop\CandLua\10-8-2019
4. Project Name: MoonShine53
5. Add files to the project from these folders: C:\Users\cbruc\Desktop\CandLua\10-8-2019 C:\Users\cbruc\Desktop\Lua53Source (Files with .c extension, not .cpp, yet)
6. Show all files in Solution Explorer
7. Finish

Well, I thought I did this before and got a long list of similar error messages, but now I'm getting the windows-processing-twirly-thing for over 16 minutes.

Thanks in advance for your time.

Thanks,

Clint Reese
 
--]] -- P.S.: My first Lua program shared with the email list!

print("Thanks again!")

I would suggest saving the headaches and looking at the WinLua project at https://github.com/WinLua. From there you can get precompiled binaries and installers for Windows, or project files or command line scripts to build from source with Visual Studio. That way the heavy lifting has already been done for you and you can get started much quicker and with much less fuss. 
Reply | Threaded
Open this post in threaded view
|

Re: -- Hi from a newbie!

Russell Haley
In reply to this post by Clinton Reese
Hi Clint,

I have a Windows binary distribution of lua on github here: https:// github.com/winlua/bin. It installs the binaries and the header files as well as a C++ interface called Sol2 (it's an hpp file) and adds environment variables so you can use Lua from the command line.  Release 1 1809a is a little old now but would be your best bet (don't use Release 2). 

The Visual Studio solution‎ for building Lua from source is in https://github.com/WinLua/WinLua-VisualStudio. The github project is quite a mess but you can pilfer the solution/project files from the Visual Studio folder. Feel free to look at Release 2 but it's quite broken and I haven't figured out why. I too am a noob but I've been at it for 5 years!

Hope that helps?

Russ
Sent from my BlackBerry 10 smartphone on the Virgin Mobile network.
From: Clinton Reese
Sent: Wednesday, October 23, 2019 5:16 AM
Reply To: Lua mailing list
Subject: -- Hi from a newbie!

--[[


I'm truly a Lua newbie. I'm such a newbie that I don't know if asking newbie questions on this email stream is wasting everyone's precious time. If so, feel free to close this message immediately!

I love the language and think Dr. Roberto Ierusalimschy is a genius, though, because I think that minimalism is the key to reliability in human designs. Plus I think designing a teaching system for a programming language around some aspects of the moon is way cool, and even wise
.
Specifically, right now, I'm trying to compile the Lua 5.3 code from source, on Windows 10, using Visual Studio 2019.

Is that my first mistake? Yeah, I attempt bad humor. I seem to be over my head with these feature-bloated IDE's designed to build and support feature-bloated programs. Perhaps I should switch to Linux or Minix for development.

I copied and pasted the Lua 5.3 source from the website into source files manually. Scripting wizard I ain't. I tried to combine the code with code from:

Specifically:

#include <stdio.h>
#include "lua.h"
#include "lualib.h"
#include "lauxlib.h"
/* the Lua interpreter */
lua_State* L;
int main ( int argc, char *argv[] )
{
        /* initialize Lua */
        L = lua_open();
        /* load various Lua libraries */
        lua_baselibopen(L);
        luaopen_table(L);
        luaopen_io(L);
        luaopen_string(L);
        luaopen_math(L);
   
        /* cleanup Lua */
        lua_close(L);
        return 0;
}

I got some kind of error about C++ not allowing default-int, I believe.

So, I manually saved the .c files with .cpp files.
Less errors, but I couldn't even seem to find the executable to run it! Comedic!

OK. I tried a new approach:

1. Open new project from existing code
2. Visual C++
3. ProjectFileLocation: C:\Users\cbruc\Desktop\CandLua\10-8-2019
4. Project Name: MoonShine53
5. Add files to the project from these folders: C:\Users\cbruc\Desktop\CandLua\10-8-2019 C:\Users\cbruc\Desktop\Lua53Source (Files with .c extension, not .cpp, yet)
6. Show all files in Solution Explorer
7. Finish

Well, I thought I did this before and got a long list of similar error messages, but now I'm getting the windows-processing-twirly-thing for over 16 minutes.

Thanks in advance for your time.

Thanks,

Clint Reese
 
--]] -- P.S.: My first Lua program shared with the email list!

print("Thanks again!")


Reply | Threaded
Open this post in threaded view
|

Re: -- Hi from a newbie!

szbnwer@gmail.com
hi there! :)

lua folks dont bite :)


+1 for linux, that helps much to improve urself, and when ull catch
up, u will feel a huge extra power under ur fingers! :D

i think for an easy start, u could try to make a dualboot, so u can
switch between linux and win. its basically a matter of partitioning,
and i think ubuntu-mate.org is a friendly distro in every sense, as
well as to start with. it is a good lesson to learn the depths of
partitioning, but u can even pm me for help, in case of need...


btw u could check out zerobrane studio, its really nice, but i dont
use it actually, cuz im making my own engine for everything...


+1 to this as well:
„I love the language and think Dr. Roberto Ierusalimschy is a genius,
though, because I think that minimalism is the key to reliability in
human designs.”


bests! :)

Reply | Threaded
Open this post in threaded view
|

Re: -- Hi from a newbie!

aryajur
In reply to this post by Clinton Reese

.
Specifically, right now, I'm trying to compile the Lua 5.3 code from source, on Windows 10, using Visual Studio 2019.


I use https://www.msys2.org/ on windows. Compiles with one command and most of the other modules available on Luarocks compile easily too.  
Reply | Threaded
Open this post in threaded view
|

Re: -- Hi from a newbie!

Sam Putman
In reply to this post by szbnwer@gmail.com


On Wed, Oct 23, 2019 at 2:10 PM [hidden email] <[hidden email]> wrote:

i think for an easy start, u could try to make a dualboot, so u can
switch between linux and win. its basically a matter of partitioning,
and i think ubuntu-mate.org is a friendly distro in every sense, as
well as to start with. it is a good lesson to learn the depths of
partitioning, but u can even pm me for help, in case of need...


Nothing wrong with a dual boot, but these days, this is the hard way 
to get started. 

I'd recommend Windows Subsystem for Linux, instructions may be 
found here:


Welcome!

cheers,
-Sam. 
Reply | Threaded
Open this post in threaded view
|

Re: -- Hi from a newbie!

Russell Haley


On Wed, Oct 23, 2019 at 1:34 PM Sam Putman <[hidden email]> wrote:


On Wed, Oct 23, 2019 at 2:10 PM [hidden email] <[hidden email]> wrote:

i think for an easy start, u could try to make a dualboot, so u can
switch between linux and win. its basically a matter of partitioning,
and i think ubuntu-mate.org is a friendly distro in every sense, as
well as to start with. it is a good lesson to learn the depths of
partitioning, but u can even pm me for help, in case of need...


Nothing wrong with a dual boot, but these days, this is the hard way 
to get started. 

I'd recommend Windows Subsystem for Linux, instructions may be 
found here:


Welcome!

cheers,
-Sam. 

Oracle Virtual Box VMs are another option. Clint used to work for a VMWare company so he may be more familiar with VMWare Workstation... 
Reply | Threaded
Open this post in threaded view
|

Re: -- Hi from a newbie!

Tim McCracken
In reply to this post by Clinton Reese

In my experience, its not too difficult to build Lua using visual studio. Lua is written as standard C, so visual studio will compile it without changes.  Here would be my tips:

Remember that Lua itself is a library. So compile it as a library. Make sure you are not including “standalone Lua” source files in the library project.

Turn off pre -compiled headers. VERY IMPORTANT. You will probably want to turn off PCH in every think that links to it as well.

If you plan to write C++ programs, then compile the library as C++, unless you have a reason not to. If you plan to stick to C code only, then compile the library as C code. Pick one or the other to do your initial builds, then you avoid dealing with mixed models.

I don’t recall any other issues. And I don’t using any Linux environments on Windows for Lua.




Reply | Threaded
Open this post in threaded view
|

Re: -- Hi from a newbie!

Tim McCracken

> On Oct 23, 2019, at 5:11 PM, Tim McCracken <[hidden email]> wrote:
>
>
> In my experience, its not too difficult to build Lua using visual studio. Lua is written as standard C, so visual studio will compile it without changes.  Here would be my tips:
>
> Remember that Lua itself is a library. So compile it as a library. Make sure you are not including “standalone Lua” source files in the library project.
>
> Turn off pre -compiled headers. VERY IMPORTANT. You will probably want to turn off PCH in every think that links to it as well.
>
> If you plan to write C++ programs, then compile the library as C++, unless you have a reason not to. If you plan to stick to C code only, then compile the library as C code. Pick one or the other to do your initial builds, then you avoid dealing with mixed models.
>
> I don’t recall any other issues. And I don’t using any Linux environments on Windows for Lua.
>
>
>
>
I should add that I did exactly what you are attempting. Just built an empty VS project and added the files to it. I would be happy to email you the project later tonight (US CDT). Just let me know.
Reply | Threaded
Open this post in threaded view
|

Re: -- Hi from a newbie!

Clinton Reese
Thanks everyone for the replies! There are lots of good ideas in here, and I may use many of them.

Mr. McCracken:

Yes, I would like to have that emailed to me. Thanks!

Clint Reese

On Wednesday, October 23, 2019, Tim McCracken <[hidden email]> wrote:

> On Oct 23, 2019, at 5:11 PM, Tim McCracken <[hidden email]> wrote:
>
>
> In my experience, its not too difficult to build Lua using visual studio. Lua is written as standard C, so visual studio will compile it without changes.  Here would be my tips:
>
> Remember that Lua itself is a library. So compile it as a library. Make sure you are not including “standalone Lua” source files in the library project.
>
> Turn off pre -compiled headers. VERY IMPORTANT. You will probably want to turn off PCH in every think that links to it as well.
>
> If you plan to write C++ programs, then compile the library as C++, unless you have a reason not to. If you plan to stick to C code only, then compile the library as C code. Pick one or the other to do your initial builds, then you avoid dealing with mixed models.
>
> I don’t recall any other issues. And I don’t using any Linux environments on Windows for Lua.
>
>
>
>
I should add that I did exactly what you are attempting. Just built an empty VS project and added the files to it. I would be happy to email you the project later tonight (US CDT). Just let me know.
Reply | Threaded
Open this post in threaded view
|

Re: -- Hi from a newbie!

Russell Haley


On Wed, Oct 23, 2019 at 4:58 PM Clinton Reese <[hidden email]> wrote:
Thanks everyone for the replies! There are lots of good ideas in here, and I may use many of them.

Mr. McCracken:

Yes, I would like to have that emailed to me. Thanks!

Clint Reese

On Wednesday, October 23, 2019, Tim McCracken <[hidden email]> wrote:

> On Oct 23, 2019, at 5:11 PM, Tim McCracken <[hidden email]> wrote:
>
>
> In my experience, its not too difficult to build Lua using visual studio. Lua is written as standard C, so visual studio will compile it without changes.  Here would be my tips:
>
> Remember that Lua itself is a library. So compile it as a library. Make sure you are not including “standalone Lua” source files in the library project.
>
> Turn off pre -compiled headers. VERY IMPORTANT. You will probably want to turn off PCH in every think that links to it as well.
>
> If you plan to write C++ programs, then compile the library as C++, unless you have a reason not to. If you plan to stick to C code only, then compile the library as C code. Pick one or the other to do your initial builds, then you avoid dealing with mixed models.
>
> I don’t recall any other issues. And I don’t using any Linux environments on Windows for Lua.
>
>
>
>
I should add that I did exactly what you are attempting. Just built an empty VS project and added the files to it. I would be happy to email you the project later tonight (US CDT). Just let me know.

I've pushed up a Visual Studio Project for 5.4 beta. I no longer specify the patch level of the version in the directory names so when the final release comes I will just update the work directory and it will build the latest. 


The 5.4 project can be seen here:

All input welcome. 

Russ