Thanks for the reply.
After my initial post I actually checked with at+creg? that I’m registered on the network before trying to send an SMS and, as the post indicated, the PIN is also correct. I use exactly the same setup (SIM, Tastrack Supreme, PC, cables, etc.) with hyperterminal to send SMSs without any problems.
I’ve also written a small program in C to enter the PIN and wait for at+creg? to report that I’m registered on the network and it, too, works. But when I try sms.send() in interactive Lua I keep getting -8. As I mentioned in the previous paragraph, at+creg? says I’m registered on the network (I also checked this using hyperterminal).
I ran some tests using hyperterminal and then lua interactive. Before each run I turned power to the Fastrack off and on to make sure I start from a clean state.
Here are the results when using hyperterminal (I’ve sent the SMS to myself so you can see that it is also received at the end)
+WIND: 13
+WIND: 1
+WIND: 7
at
OK
at+cpin=1234
OK
+WIND: 16
+WIND: 4
+WIND: 10,"SM",0,"FD",0,"ON",0,"SN",1,"EN",0
+WIND: 11,,, -- checksums deleted
at+creg=2
OK
+CREG: 1,"0067","55E1"
at+creg?
+CREG: 2,1,"0067","55E1"
OK
at+cmgs="0123456789"
> hello from hyperterminal
+CMGS: 9
OK
+CMTI: "SM",19
at+cmgr=19
+CMGR: "REC UNREAD","0123456789",,"09/06/30,22:01:53+08"
hello from hyperterminal
OK
Here are the results when using lua interactive.
Note that I have redefined sms.send() so that I can get the result code.
Lua interactive shell
$ =at('at+cpin=1234');
= { "\r\nOK" }
$ =at('at+creg=2')
= { "\r\nOK" }
$ =at('at+creg?')
= {
"\r\n+CREG: 2,1,\"0067\",\"55E1\"",
"\r\nOK" }
$
$ -- redefine sms.send() so that we get return codes
$ function sms.send(phone_nr, msg)
local rc_sms = internal.sms_send(phone_nr, msg);
if (rc_sms < 0) then
return rc_sms;
else
local _, ev = wait('sms', '*');
return ev;
end
end
$
$ global 'rs'
$ rs = sms.send('0123456789', 'hello from lua interactive'); p(rs)
-8
$
Here is another session where I first call sms.init() and then internal.sms_send()
Lua interactive shell
$ =at('at+cpin=1234');
= { "\r\nOK" }
$ =at('at+creg=2')
= { "\r\nOK" }
$ =at('at+creg?')
= {
"\r\n+CREG: 2,1,\"0067\",\"55E1\"",
"\r\nOK" }
$ h = sms.init(); p(h)
true
$ rc_sms = internal.sms_send('0123456789', 'Hello from Lua'); p(rc_sms)
-8
$
Is there a way to determine which version of oatlua I’m actually using? Something weird is going on here 
chris