Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Importing Lua as a static library

I am attempting to import Lua 5.3 as a static library into my current game project. I have followed this to the letter, and to no avail. When I try to build the solution, I get these errors: Image of VS2013 errors

I have both downloaded and tried lua-5.3_Win64_vc12_lib.zip and lua-5.3_Win32_vc12_lib.zip from here, as well as building lua myself and trying that. All to no avail. Here is my module implementation code:

 public bool LoadLua(TargetInfo Target)
     bool isLibrarySupported = false;
     if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32))
         isLibrarySupported = true;
         string PlatformString = (Target.Platform == UnrealTargetPlatform.Win64) ? "x64" : "x86";
         string LibrariesPath = Path.Combine(ThirdPartyPath, "Lua", "Libraries");
         PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "lua53." + PlatformString + ".lib"));
     if (isLibrarySupported)
         // Include path
         PublicIncludePaths.Add(Path.Combine(ThirdPartyPath, "Lua", "Includes"));
     Definitions.Add(string.Format("WITH_LUA_BINDING={0}", isLibrarySupported ? 1 : 0));
     return isLibrarySupported;

It was mostly copied from the tutorial, but I laid out the directory structure to meet their requirements as well.

Please also note I am not trying to use lua to code my game instead of C++, or anything like that, I am just trying to implement lua into the game because there will be programmable parts in it (all done in lua).

Thankyou for your time.

Product Version: Not Selected
capture.png (29.2 kB)
more ▼

asked May 11 '15 at 02:07 AM in C++ Programming

avatar image

120 11 11 13

avatar image Azarus May 11 '15 at 02:30 AM

If you ever get this done, please make a tutorial about it!

You don't have to listen to the Visual Studio's error log.

Look at the output log since IntelSense may give you false errors.


Make sure this code path points to the valid .lib files and is getting called.

    PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "lua53." + PlatformString + ".lib"));

Please make sure you're using the correct libraries / platform. http://www.cplusplus.com/forum/windows/114016/

avatar image Wafflecopta May 11 '15 at 03:26 AM

Well I have toyed around with it some more, and am now producing a different error: error LNK2019: unresolved external symbol _HUGE referenced in function luaopen_math

avatar image Azarus May 11 '15 at 07:41 AM

I guess you need to recompile lua from source to get proper 64bit binaries for ue4. Try with a newer version of vs. (vs120 maybe?)

avatar image apakanati Oct 16 '15 at 12:49 PM

For what it's worth, recompiling from source worked for me in removing the unresolved external symbol __HUGE issue. Fortunately it's not painful at all, either.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first


I'm having the same problem here, I don't know if you resolved it?

I manage to get to the point where the Compiler recognizes "#include " and finishes without errors. But once I actually try to add code like for example lua_State *L = luaL_newstate(); the compiler gets a Linker error.

I guess the problem could be that the stock Library for LUA is in 32bit.

Any Help would be appreciated!

more ▼

answered Aug 26 '15 at 02:39 AM

avatar image

1 2 3 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question