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)
分享到:
- 2009-11-24 11:00
- 浏览 1105
- 评论(0)
- 论坛回复 / 浏览 (0 / 2411)
- 查看更多
相关推荐
then shows you how to create games using the top Lua frameworks like Corona SDK, Gideros, Moai, and even how to create games on the iPad (not just for the iPad) with Codea. You aren't tied to Xcode ...
Lua脚本语方学习笔记,作为学习lua的参考
it’s a development kit made out of ESP8266, which is a cheap Wi-Fi microcontroller, and in this book you can find How to program the Nodemcu using Lua Programming language, This book will teach you ...
then shows you how to create games using the top Lua frameworks like Corona SDK, Gideros, Moai, and even how to create games on the iPad (not just for the iPad) with Codea. You aren’t tied to Xcode...
You'll learn how to write clean, easily maintainable, easily expandable game code, and to create online leaderboards for your games. You'll also find out how to make money with games: enabling in-app...
lua for windows其实是一整套Lua的开发环境.Lua for Windows 为 Windows 系统下提供了 Lua 脚本语言的开发和运行环境。Lua 是一个小巧的脚本语言。作者是巴西人。该语言的设计目的是为了嵌入应用程序中,从而为应用...
Lua for Windows is a 'batteries included environment' for the Lua scripting language on Windows. Lua for Windows (LfW) combines Lua binaries, Lua libraries with a Lua-capable editor in a single ...
In order to execute LUA scripts you have to load them first and call them afterwarts, this is done by respectivily calling the lua_load and the lua_call or lua_pcall function. The lua_load function ...
C语言头文件 LUA_CC语言头文件 LUA_CC语言头文件 LUA_CC语言头文件 LUA_CC语言头文件 LUA_CC语言头文件 LUA_CC语言头文件 LUA_CC语言头文件 LUA_CC语言头文件 LUA_CC语言头文件 LUA_CC语言头文件 LUA_CC语言头文件 ...
Lua is a small and simple language, partly because it does not try to do what C is already good for, such as sheer performance and interface with third-party software. Lua relies on C for these tasks...
在Linux底下,从C语言调用Lua代码的一个简单例子。
For example, you should be able to extract a Unicode string from a database and pass it to a Unicode-aware graphics library. But see the sections below on pattern matching and string equality. ...
LUAC 脚本加密 , 用于LUAC 脚本反编译,有用得同学可以下载,
Visual Studio Extension for Lua is a free, open source plugin that turns Visual Studio into a Lua development environment. It is designed, developed, and supported by Microsoft and the community. The...
his book is a detailed and authoritative introduction to all aspects of Lua programming written by Lua's chief architect. Programming in Lua provides a solid base to any programmer who wants to use ...
ios版本将lua加密成luac
The authors present the fundamentals of programming, explain standard Lua functions, and explain how to take advantage of free Lua community resources. Complete code samples are integrated throughout...
luabind is a library, inspired by and similar to Boost.Python, that helps you create bindings between C++ and Lua. It has the ability to expose functions and classes, written in C++, to Lua.
mac下使用的luac编译lua luac文件支持64位 基于5.1版本 mac下使用的luac编译lua luac文件支持64位 基于5.1版本 mac下使用的luac编译lua luac文件支持64位 基于5.1版本