GithubHelp home page GithubHelp logo

Comments (4)

pkulchenko avatar pkulchenko commented on June 10, 2024 1

I agree that it is indeed strange, as I'd expect the statically compiled executable to use the library that is compiled in instead of trying to resolve the links dynamically.

The only difference between launching outside of the IDE and from it is that the environment variables are set differently. Can you try running wx.wxUnsetEnv('LUA_CPATH') before calling ExecuteCommand? It will have to be restored after the call, so it's working for other calls, but it will allow you at least to check if it helps with this issue or not.

from zerobranestudio.

sduensin avatar sduensin commented on June 10, 2024 1

That was the secret! I'll dig some more to see if I can change the behavior of Singe to make more sense, but for now, that fixed it.

Thank you!

from zerobranestudio.

pkulchenko avatar pkulchenko commented on June 10, 2024 1

@sduensin, that's an interesting approach; thank you for sharing! I would have simply used https://www.lua.org/manual/5.4/manual.html#luaL_requiref, but, as described in the post, it's a good way to solve this problem (by only loading what's actually used).

from zerobranestudio.

sduensin avatar sduensin commented on June 10, 2024

For anyone reading this later, here's how I finally really fixed it...

My embedded Lua instance and it's embedded modules used the searcher code I found here:

https://leiradel.github.io/2020/03/01/Embedding-Lua-Modules.html

That adds the new searcher to the end of the package searcher table. I modified the code to put it at the head:

	// Get the package global table
	lua_getglobal(L, "package");
	// Get the list of searchers in the package table
	lua_getfield(L, -1, "searchers");
	// Get the number of existing searchers in the table
	length = lua_rawlen(L, -1);
	// Shift existing elements to make room for ours
	for (i=length+1; i>1; i--) {
		lua_rawgeti(L, -2, i - 1);
		lua_rawseti(L, -2, i);
	}
	// Add our own searcher to the front of the list
	lua_pushcfunction(L, luaSearcher);
	//lua_rawseti(L, -2, length + 1);
	lua_rawseti(L, -2, 1);
	// Remove the seachers and the package tables from the stack
	lua_pop(L, 2);

from zerobranestudio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.