From c61df1e41984efa46fe1e6acd88509390472c97f Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Fri, 28 Mar 2014 22:19:04 +1000 Subject: More random notes. --- ClientHamr/GuiLua/README | 9 +++++++++ ClientHamr/GuiLua/skang.lua | 3 +++ ClientHamr/GuiLua/test_c.c | 3 +++ 3 files changed, 15 insertions(+) (limited to 'ClientHamr') diff --git a/ClientHamr/GuiLua/README b/ClientHamr/GuiLua/README index 4198025..72c1069 100644 --- a/ClientHamr/GuiLua/README +++ b/ClientHamr/GuiLua/README @@ -388,6 +388,15 @@ that has hard coded mappings between some basic "label", "button", etc. and ordinary elementary widgets. Proper introspection can come later. +LuaJIT FFI notes +---------------- + +LuaJIT 2.0 FFI needs to have cleaned up versions of C header files +included in the Lua scripts that use it. This is messy. Version 2.1 +(or perhaps 3.0) has on it's road map to include a C pre processor, +which should help that problem. + + EO notes -------- diff --git a/ClientHamr/GuiLua/skang.lua b/ClientHamr/GuiLua/skang.lua index 6f06131..2b21cb9 100644 --- a/ClientHamr/GuiLua/skang.lua +++ b/ClientHamr/GuiLua/skang.lua @@ -157,6 +157,8 @@ end -- Call this now so that from now on, this is like any other module. local _M = moduleBegin('skang', 'David Seikel', 'Copyright 2014 David Seikel', '0.1', '2014-03-27 02:57:00') +-- TODO - While it is possible to get LuaJIT version info, need to load the 'jit' module, which wont work so well if we are not in LuaJIT. +-- local jit = require 'jit'; jit.version; jit.version_num; jit.os; jit.arch print('Skang is running under Lua version ' .. _VERSION) @@ -685,3 +687,4 @@ access to the module. -- Gotta check out this _ENV thing, 5.2 only. Seems to replace the need for setfenv(). Seems like setfenv should do what we want, and is more backward compatible. -- "_ENV is not supported directly in 5.1, so its use can prevent a module from remaining compatible with 5.1. -- Maybe you can simulate _ENV with setfenv and trapping gets/sets to it via __index/__newindex metamethods, or just avoid _ENV." +-- LuaJIT doesn't support _ENV anyway. diff --git a/ClientHamr/GuiLua/test_c.c b/ClientHamr/GuiLua/test_c.c index e3fd801..e8c2bfd 100644 --- a/ClientHamr/GuiLua/test_c.c +++ b/ClientHamr/GuiLua/test_c.c @@ -114,6 +114,9 @@ int luaopen_test_c(lua_State *L) // Save this module in the C registry. lua_setfield(L, LUA_REGISTRYINDEX, ourName); +// TODO - This is too verbose. I've had an idea for writing some sort of generic wrapper, though others have done the same. +// http://www.lua.org/pil/25.3.html seems the most reasonable of the examples I've found. + // skang.thing('cfooble,c', 'Help text goes here', 1, 'number', \"'edit', 'The fooble:', 1, 1, 10, 50\", true) lua_getfield(L, skang, "thing"); lua_pushstring(L, "cfooble,c"); -- cgit v1.1