Problem with gsub ?

Jan 9, 2015 at 2:06 PM
Edited Jan 9, 2015 at 2:08 PM

I'm getting a "Not implemented exception" with the following code:
local line = 'this is a test line'
local toks      = {}
local sep       = ";"
line:gsub( "([^"..sep.."]*)"..sep, function( tok ) table.insert( toks, tok ) end )
Note that this works perfectly with LuaInterface. Does this just mean that 'gsub' is present but hasn't been implemented yet ?

Thanks for fixing this...
Jan 9, 2015 at 8:48 PM

correct, I did not implement gsub, simply because in my scripts it is not present.

There are tree ways we have, now:
  1. You replace gsub with the .net equivalent.
  2. You ask me to implement the function. It would be nice to get some test cases.
  3. It is open source: And you can implement the function and contribute it on github.
What is your choice?
Jan 9, 2015 at 9:12 PM
Well honestly as I am moving from LuaInterface I was hoping I could reuse my scripts. It turns out I can't for this and other reasons and thus have to rewrite them partly. There are plenty and sometimes the linked .NET part has to be altered consequently.

It would be nice and I believe would give more credit to your library if at some point you had a full solid LUA library. I think many people will like me search an alternative to LuaInterface (or NLua) because of the memory leaks and the lack of 64 bit support for LuaInterface (those I my 2 main reasons).

Currently I use string.Split to replace the use I was making of gsub there and it's good enough. But I noticed different other things missing like the "module" keyword I believe (which makes me wonder why we still have "require"). For that I now use a simple global table.

So option 2 is of course preferred. I do not have the time to contribute unfortunately. I'm actually using your library in a project I use internally at work. As for the test cases well you already got one here and some on (

Thanks for making the library anyways. It's good to finally have something like this !
Jan 9, 2015 at 9:32 PM
Edited Jan 9, 2015 at 9:33 PM
I also would like to see NeoLua, in the script part, to be full compatible to the original. So, it is possible to take a script and run it in both worlds. But to achive this, there are some functions to need to be implemented (LINK to doc).

We have investigated your 2 main reason early enough, so it was easy to change the parts in the a small set of lua scripts.

"module" keyword? Never heart of that.

The problem of the package stuff of the c-lua is, that it havy depends on C. And this is hard to emulate. The most common case I noticed is the function "reqiure". That I hopefully implemented in a "good enough" way.

It is good that people use the library. So, it will hopefully strong enough to be a good alternative.

Do you now a good explaination/.net library of the POSIX expression syntax?
What me converns is: "A typical implementation of POSIX regexp takes more than 4,000 lines of code. This is bigger than all Lua standard libraries together. In comparison, the implementation of pattern matching in Lua has less than 500 lines. "

It is still on my plan, but I also have a lot to do on other projects, currently.
Jan 10, 2015 at 12:08 PM
Edited Jan 10, 2015 at 12:11 PM
Ok well as it's doable with the .NET extensions in string it's ok for now. People just need to know what's missing I think. So that they can adapt without searching the cause of their problems for hours. It can sometimes be painful.

About "module" I think a module is what you call a package. Here's the documentation: And here's a use I did make of it:
module( "file_helper", package.seeall )

function exists( path )
    --  code

function dirExists( path )
    --  code

function makeDir( folder )
    --  code
I was first executing this file when loading includes and then elsewheere I would do this:
local fileh         = require "file_helper"

-- code ...

if fileh.exists( myFile ) then
    --  code...
I'm not sure how you would use the "require" keyword in your library. I haven't found a utility to it. I thought you meant it for C# static classes (that's what I understood from your doc) but I can use those without "require" if I point to them with "clr.XXX". Maybe you mean if you "require" them they become "const" ? Anyways I was trying to make a lua module not a C# module and I don't see how to do so currently.
Jan 12, 2015 at 4:23 PM
Edited Jan 12, 2015 at 4:26 PM
For this reason I tried to write a documentation. If there is something unclear let me know.

Module is a function that is not in the official language documentation. It seems to be an add on, that manipulates the global variable. I will see, what I can do. I will put it on my list.

"require" compile and run the file. The return value of the script is the return- alue of require. So, it supports the normal module pattern.
-- file1
return {
  a = 2

-- or file2
local M = {}

M.a = 2;

return M;

-- main
test = require "file1.lua";
It has nothing todo with the clr package. Can you give me the position of the doc, that a can clearfy this.