GP-Probe has a built-in LUA v.5.3.1 interpreter and debugger. This allows you to create a variety of custom reaction scenarios for different events.
GP-Probe TGE2 supports following libs:
- https://www.lua.org/manual/5.3/manual.html#6 Base
- https://www.lua.org/manual/5.3/manual.html#6.4 String
- https://www.lua.org/manual/5.3/manual.html#6.7 Math
- SYS Lib - Provides access to internal variables and delay function
- COM Lib - Provides access to RS232/485/422 ports
GP-Probe does not have a file system, so you can't use functions dealing with files\folders
The script runs every time the probe or GNSS status is changed. If errors occur during the execution of the script, they are sent to the server log. To access the LUA code debugger, log in to the configuration panel as "admin" and go to the "Admin/
Automation Script" menu. There you can see the current script and the results of its last run:
Script Debugging
Just click the debugger button.
In debug mode, the GP-Probe stops automatically running the script when the status changes.
In the "Variables" section you see which variables are available to you during the code execution. You can change their value to debug the behavior of your script.
Read here how to query variables.
LUA Script Example
com.init(2, 230400, "NONE", 1); com.write(2, "Probe Status Old: " .. sys.get_status_str("OLD_STATUS") .. "\n"); com.write(2, "Probe Status New: " .. sys.get_status_str("NEW_STATUS") .. "\n"); com.write(2, "GPS Spoofing Flag Old: " .. sys.get_status_str("OLD_GPS_SPOOFING") .. "\n"); com.write(2, "GPS Spoofing Flag New: " .. sys.get_status_str("NEW_GPS_SPOOFING") .. "\n"); com.write(2, "GLO Spoofing Flag Old: " .. sys.get_status_str("OLD_GLO_SPOOFING") .. "\n"); com.write(2, "GLO Spoofing Flag New: " .. sys.get_status_str("NEW_GLO_SPOOFING") .. "\n"); com.write(2, "GAL Jamming Flag Old: " .. sys.get_status_str("OLD_GAL_JAMMING") .. "\n"); com.write(2, "GAL Jamming Flag New: " .. sys.get_status_str("NEW_GAL_JAMMING") .. "\n"); com.write(2, "BDS Jamming Flag Old: " .. sys.get_status_str("OLD_BDS_JAMMING") .. "\n"); com.write(2, "BDS Jamming Flag New: " .. sys.get_status_str("NEW_BDS_JAMMING") .. "\n"); com.init(1, 230400, "NONE", 1, "RS485") a=math.cos(90.0) com.write(1, a.."\r\n") t = {"one", "two", "three"} for i, v in pairs(t) do com.write(1, i.." -> "..v.."\r\n") end s=[[hello \x77\x6f\x72\x6c\x64]] s=s:gsub("\\x(%x%x)",function (x) return string.char(tonumber(x,16)) end) com.write(1, s.."\r\n") ind = s:find("world") com.write(1, "Index of 'world' is "..ind.."\r\n") local func, err = load("return function(a,b) return a+b end") if func then local ok, add = pcall(func) if ok then com.write(1, add(11,12).."\r\n") else com.write(1, "Execution error: "..add) end else com.write(1, "Compilation error: "..err) end