A un-tested build of liblua-sqlite3 for PXLua 5.1 is attached to this message.
Is there any change between LUA 5.02 build and this except LUA versions?
Quote from: GeceBekcisi on 30 May, 2006, 12:06:40
Is there any change between LUA 5.02 build and this except LUA versions?
The build for Lua 5.0.2 is based on lua-sqlite3-0.3
The build for Lua 5.1 is based on lua-sqlite3-0.4.1
For further differences please see the readme.txt,
and consult the documentation provided on
Luaforge.net and in the zipped archive.
There is also probably the need for the borland dependency
wich can be downloaded from one of the mirrored sites.
Mirror site updated with File and Borland dependencies (incase needed)
http://bluebear.psycho-chihuahua.net/#pxsqll3
Quote from: Mutor on 31 May, 2006, 00:22:06
Thanks for the up, bluebear.
You're still my hero.? ? ;D
Humming Stephen Lynch - "If I could be a superhero, I would be programmer-man"...
Btw. has anyone confirmed that this library actually works?
Quote from: bluebear on 01 June, 2006, 08:56:26
Btw. has anyone confirmed that this library actually works?
Syntax ../PxSQLite3.lua:81: attempt to index global 'sqlite3' (a nil value)
with
local _luaopen_sqlite3 = package.loadlib("pxsqlite3L51.dll", "_luaopen_sqlite3")
_luaopen_sqlite3()
sqlite3.version()
snif snif, more fighting tomorrow.
plop
Syntax ../PxSQLite3.lua:81: attempt to index global 'sqlite3' (a nil value)
Same problem here. Anybody figure out what's wrong?
I guess none of you got it to work.
I'll fix the problems in the near future.
Fancy writing a dummies guide for how to do it, so i can have a go in the future. :)
A guide on howto create a extension for PXLua ?
Actually its rather easy :)
C++ lib for Lua 5.1:
#pragma comment(lib, "PXLua.lib")
extern "C" { // we dont need all of them in this sample, but does not hurt to include all
# include "lua.h"
# include "lualib.h"
# include "lauxlib.h"
};
// The HelloWorld lua function
int lua_helloworld (lua_State *L) {
if (lua_gettop(L) != 0) { // check no of arguments - we expect none (we dont need to do this in this case, but its just to show how)
luaL_where(L,1); // at witch line did the error happen in the script
lua_pushliteral(L, "Function should be called without arguments!"); // push the message
lua_concat(L, 2); // concat; merge the where-message and the error-message
lua_error(L); // halt the script and display the message
}
lua_pushstring(L, "Hello World!");
return 1; // the number of objects we pushed onto the stack
}
// table of methods to register
static const luaL_reg our_methods[] = {
{"FunctionName", lua_helloworld},
{0,0}
};
// Lua entry point when loading
int __declspec(dllexport) libinit (lua_State* L) {
luaL_register(L, "TableName", our_methods);
return 0;
}
-- EOF --
The script:
libinit = package.loadlib("px_helloworld.dll", "_libinit") // the existance of "_" in the entrypoint depends on you compiler options.
libinit()
retval = TableName.FunctionName()
SendToAll(retval)
-- EOF --
Updated (0.3.5.1c) PXLua-Sqlite3-0.4.1...
For Lua 5.1.1 (http://www.ptokax.org/files/Libs/PXLua-Sqlite3-0.4.1-Lua-5.1.1.7z)
Source (http://www.ptokax.org/files/Libs/PXLua-Sqlite3-0.4.1-src.7z)
Initializing like
require "sqlite3"
This will register global sqlite3 8)
Well, is very hard to use this lib because missing documentation and script needed to use it. Get documentation and script here (http://www.ptokax.org/files/Libs/PXLua-Sqlite3-0.4.1-Lua-5.1.1-add.7z).