Original link: http://sunxiunan.com/?p=1498
You could download the project from http://groups.google.com/group/lua5/web/luautil.rar
At first, create a windows dll application. The IDE I used is VC2008.
I suggest you download and install the "Lua for windows " from luaforge.net, it contains most useful packages for Lua windows development. You could copy "include" and "lib" directory under the installation directory to your project.
In the beginning, you should include Lua header files.
Please note, you should use extern "C" to declare the header for Lua. In linker’s input, set the lua51.lib.
The project should have a function like luaopen_xxx (in my code, it is luaopen_luautil), and have strings=>functions map structure like "lua_util". Then you could call your extension like require "luautil".
The L_MSleep will call windows’ api Sleep().
Another function L_NewTable will generate a complex table for Lua script. It will call lua_settable() and lua_setfield() function to manipulate the table in Lua. lua_pushstring() and lua_pushnumber() could push string type and number type data to Lua. You could find the document about these functions in Lua 5.1 manual.
The table that Lua get will like:
local table1 = {
userName1 = "hahaha",
serialNumber1 = "1234613423",
tbl = {userName2 = "wwwww", serialNumber2 = "asdfasdadf", "5566", "wowowo"}}
After you build the project, copy the dll to lua installation folder "lua\5.1\clibs".
In the end, we could test the extension like:
require "luautil"
local newtable =luautil.newtable()
for k, v in pairs(newtable) do
print(k, v)
if type(v) == "table" then
for k2, v2 in pairs(v) do
print("–", k2, v2)
end
end
end
– sleep 5 seconds.
luautil.msleep(5000)
来源:网络
Step by step installation of the Backup Exec Remote Agent for Linux and UNIX Servers (RALUS) on the Red Hat Linux platform. 文章: 100017476 上次发布时间: 2019-06-05 评级: 11 5 产品: Backup Exec Pr...
SharePoint 2010对工作流的创建与使用提供了友好的支持,我们有四种选择: SharePoint 2010:脱箱(Out-Of-The-Box)工作流 Visio 2010:可视化工作流,可以导入、导出工作流 SharePoint Designer 2010:无代码工作流 Visual Studio 2010:高级、自定义工作流 本次我们使用SharePoint 2010 内置的三态工作...
While Cocos2D is compatible with ARC, simply enabling ARC in the project’s Build Setting will throw several hundreds of errors in your face. Cocos2D doesn’t provide ARC-enabled...
Created by Jerry Wang on Jul 10, 2014 1. First of all we need to create a new Material in ERP system, so that it could be downloaded to CRM system. In this example I create Material ZJERRYERP1 in ERP ...
前言 最近接连遇到几个朋友问我同一个问题,就是关于.NET平台上ORM框架的选择。我想在这个讲求效率的时代,谁也不想手写SQL或存储过程去访问数据库了。大家都知道,在Java平台上,ORM这一块基本是Hibernate的天下。当然,相对轻量级的iBatis也有不错的表现。 不...
There is a configuration file LINSlaveConformanceTest.cfg for LIN slave conformance test at C:\Users\Public\Documents\Vector\CANoe\Sample Configurations 11.0.55\LIN\LINSlaveConformanceTest\. Make sure...
RDL(C) Report Design Step by Step 2: SubReport http://www.cnblogs.com/waxdoll/archive/2006/07/24/458409.html 前两天,有网友在Blog上评论要求将子报表的配置贴出来,由于这两天有些别的事情,所以耽搁了;另外,自己也比较懒,有些东西明明应该早就写出来的。呵呵,说声“对不起&rdqu...
http://www.cnblogs.com/waxdoll/archive/2006/06/23/434215.html(转) 前一段时间,发了几篇关于RDLC报表的随笔,由于这些随笔中没有关于报表设计方面的内容,于是不少网友和我联系,问了一些关于报表设计方面的问题,最近准备写几篇关于RDLC报表设计的随笔。 这篇随笔主要描述实现钻取报表的步骤。 钻取报表的数据源应该是两个具有主子关系的表,在这...
1.安装 xmware,安装centos(此步省略步骤) 2.设置虚拟机网络模式为NAT 3.输入 ip address 命令,记录下名字为ens33 (你们可能是别的名字) 4.使用vi 命令 打开编辑网络配置文件vi /etc/sysconfig/network-scripts/ifcfg-ens33 最后ens33为第三步红框部分名称。打开后这里no改为yes。 (这里注意按a可以进行编辑 ...
如何写简历 思维导图 自我反思 思维导图提取自如何写「前端简历」,能敲开字节跳动的大门?,具体细节还是应该去看一下原文会比较好。但是根据这个思维导图去重写、重构、提升简历会比较方便。 思维导图 自我反思 对照自己的年度计划来看,1-4年的提升这一块的自我调教目的性、针对性都是比较强的,唯一有一定缺陷性的就是导图中思考这一块下面的部分。 在日常工作当中,还是应该注重一下: 项目结构 组件服用 工程化...
The project I'm working on has a lot of boilerplate code for passing Repository objects around. The parent object creates a repository, passes it to any utility / helper methods to do some specific wo...
I have profile page where logged in user can edit information about himself. There are some fields with default values, for example in $user->about_me there is default value: Tell us something abou...
I have an element in an array that I'd like to move accordingly. Basically I'd like to find the index of "c" and then place it before "d" again based on "d"'s index. I'm ...
I don't understand where I made a mistake, please help me. Variable declaration syntax was not correct. Please check link https://docs.oracle.com/cd/B19306_01/appdev.102/b14261/overview.htm#BABEABGF P...
I am getting Data using Eloquent by the following way and with pageinate I am getting 2 coloumn in the target page but i don't know how to display the pagination in the view. I tried to display {{ $pa...