Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Lua and lpeg

Jun
26
0
I was very happy when Lua support was added to TC. On a whim I compiled a Lua addon (lpeg) and placed the resulting dll into the TC folder. To my pleasant surprise this worked and I can now run all of my Lua scripts that require the lpeg addon.

I have two questions:

1. Does TC's support for Lua work because Lua was embedded into the TC run time. Apologies if I am not using these programming terms correctly.

2. Why does dropping lpeg.dll into the TC directory work. That is, why can I now run any script that requires lpeg work?

thanks
rick
 
1. From help file:
Lua support

Lua is a powerful, fast, lightweight, embeddable scripting language. TCC includes internal support for Lua, both for executing Lua scripts and for executing individual Lua expressions. The version supplied with TCC is Lua 5.3. For more information on Lua, go to The Programming Language Lua.

You must enable Lua support in the OPTION / Startup page. If it is enabled, TCC will automatically load LUA.DLL on your system. TCC checks to see if you are running a .LUA file. If so, TCC passes the file to the Lua interpreter for processing.

For p.2, that's because you told it to do so.
`require "lpeg"` will look for appropriate .lua script in LUA_PATH (or `package.path`) or a DLL in LUA_CPATH (or in `package.cpath`). I suppose `package.cpath` equals to TCC installation directory by default.

See f.e. how to use / include lpeg luapeg re module answer.
 

Similar threads

Replies
0
Views
2K
Back
Top