GithubHelp home page GithubHelp logo

cppandluacalltest's Introduction

CppAndLuaCallTest

C++与Lua相互调用例子

交互原理

lua和c / c++的数据交互通过栈进行,操作数据时,首先将数据拷贝到"栈"上,然后获取数据,栈中的每个数据通过索引值进行定位,索引值为正时表示相对于栈底的偏移索引,索引值为负时表示相对于栈顶的偏移索引,索引值以1或 - 1为起始值,因此栈顶索引值永远为 - 1, 栈底索引值永远为1 。 “栈"相当于数据在lua和c / c++之间的中转地。每种数据都有相应的存取接口

三个例子

主要文件,CppAndLuaCallTest.cpp和test.lua

  • C++加载Lua文件,调用Lua代码
  • C++加载lua代码的同时注册C++方法,在Lua中调用注册的C++方法
  • 编写导出方法,生成dll,Lua调用dll导出的C++方法

cppandluacalltest's People

Contributors

iwiniwin avatar

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.