Lua Fuzzy

lua-users home
wiki

A very simple Lua extension that only defines one function 'fuzzy'.

VersionNotice: This page pertains to an earlier version of Lua (4.0 and 5.0beta) using a loadmodule extension. Lua 5.1 instead uses package.loadlib and require. Lua 5.0 uses loadlib.)


loadmodule("fuzzy")

thetext = [[A lnger Text to saerch]] 

searchstr = "longer" 

print(fuzzy(thetext,searchstr)) 

-- gives about 54.54 

-- while 

print(fuzzy(thetext,"lnger")) 

-- gives 100, a complete match 

This Lua extension was built to be used with the 'loadmodule' by IgnacioCastano/ThatcherUlrich LuaBinaryModules

Main goal was to write a 'tutorial' like minimal extension that is completely self-sufficent, only requiring one C source file. The code is based on an [article] in c't 4/97.

A Win32 Lua binary, the compiled luafuzzy.dll along with the source can be downloaded [1]. (updated 2002-11-22 to use the changed luaLM_version() and luaLM_import() names) (updated 2002-11-25 changed to use lua-4.0.dll and lualib-4.0.dll. luafuzzy.dll is now compatible with IgnacioCastano Lua binary)

A Lua 5.0-beta compatible version of the c source [2] and a Win32 mingw-msys Makefile [3] are available for download. Place the files in lua-5.0-beta/mods/fuzzy for the Makefile to work. You may also need the config file [4].


RecentChanges · preferences
edit · history
Last edited January 14, 2007 12:55 am GMT (diff)