Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attributes are not accessible in Lua in VisualStudio builds #23258

Closed
ZhilkinSerg opened this issue Mar 19, 2018 · 8 comments

Comments

Projects
None yet
2 participants
@ZhilkinSerg
Copy link
Contributor

commented Mar 19, 2018

Following Lua code returns nil values when I compile in Visual Studio 2015 on Windows:

local tp = tripoint( 11, 22, 33 )
print("X:"..tostring(tp.x))
print("Y:"..tostring(tp.y))
print("Z:"..tostring(tp.z))

It works fine with downloaded binary or when I compile in Code::Blocks (MSYS) on Windows.

Can someone please confirm the issue exists or is it something in my system?

Edit (2018-05-10): Same issue on fresh Windows 10 with Visual Studio 2017.

@BevapDin

This comment has been minimized.

Copy link
Contributor

commented May 28, 2018

Did you actually compile with Lua support? Does any other Lua code work? Does it work for point or for some other value received from the game (e.g. some item property)?

@ZhilkinSerg

This comment has been minimized.

Copy link
Contributor Author

commented May 28, 2018

Did you actually compile with Lua support? Does any other Lua code work? Does it work for point or for some other value received from the game (e.g. some item property)?

All Visual Studio configurations have SDL and Lua enabled. Lua works (e.g. I can run print(_VERSION), game.popup("sometext") or dofile('./1.lua') in console), but all attributes (defined in class_definitions.lua) are not accessible.

image

1.lua.txt

@BevapDin

This comment has been minimized.

Copy link
Contributor

commented May 28, 2018

Well, the script works here on Linux (Lua 5.3). Did it work previously? Is the file "src/lua/catabindings.cpp" up to date? (Should be about 1 MB large.)

@ZhilkinSerg

This comment has been minimized.

Copy link
Contributor Author

commented May 28, 2018

Well, the script works here on Linux (Lua 5.3). Did it work previously? Is the file "src/lua/catabindings.cpp" up to date? (Should be about 1 MB large.)

Yeah, I know it works. It will work fine if I grab pre-compiled version from Jenkins or compile myself on Linux or on Windows via Code::Blocks (MSYS).

Yes, src/lua/catabindings.cpp is up to date and is being regenerated normally (I didn't compare this file generated on different systems, but I believe it will be the same as it is being generated by lua which is the same on different platforms).

I was using Code::Blocks (MSYS) on Windows for building my Lua PRs and found that Lua is partly not working in VS only by chance. I don't know when it stopped worked on VS, but I have probably tested some basic Lua statements in VS builds last year (including point attributes).

I will probably need to bisect - though it is PITA on Windows.

@ZhilkinSerg

This comment has been minimized.

Copy link
Contributor Author

commented May 28, 2018

This one here could be from VS:

#22308 (comment)

@ZhilkinSerg

This comment has been minimized.

Copy link
Contributor Author

commented May 28, 2018

So, I've put contents of /lua/catabindings.cpp instead of #include "lua/catabindings.cpp" in catalua.cpp, put a breakpoint inside of get_tripoint_x function and now I get this:

image

That is not so good.

@ZhilkinSerg

This comment has been minimized.

Copy link
Contributor Author

commented May 28, 2018

Hmm... I've added get_point_x and get_point_y functions as members of static const struct luaL_Reg gamelib [] and now breakpoints are not optimized away, but I do not hit the breakpoint when I run print("pX:"..tostring(tp.x)) in Lua.

@ZhilkinSerg ZhilkinSerg changed the title Tripoint fields are not accessible in VisualStudio builds Attributes are not accessible in Lua in VisualStudio builds Jun 16, 2018

@ZhilkinSerg

This comment has been minimized.

Copy link
Contributor Author

commented Oct 27, 2018

Seems to be resolved when using vcpkg and v141 tools (see https://github.com/ralreegorganon/Cataclysm-DDA/tree/vs-local-mods).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.