--[[
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
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.