lua '=' expected near 'G1' - lua

Was following this guide: http://blog.jgc.org/2012/03/ambient-bus-arrival-monitor-from-hacked.html
Im currently stuck on this bit "The program has three parameters: a comma separated list of bus routes, a bus stop number and a 'walking time'. For example, it's possible to do:
lua ambibus.lua 3,12 50906 2"
The bus that runs near my house is the "G1" and whenever i try to add it in PuTTy is says '=' expected near 'G1'
If i copy and paste the code in the instructions i get "lua: cannot open ambibus.lua: No such file or directory"
Help please

Related

Split or tokenize within Stata program with using statement?

I am trying to use a program to speed up a repetitive Stata task. This is the first part of my program:
program alphaoj
syntax [varlist] , using(string) occ_level(integer) ind_level(integer)
import excel `using', firstrow
display "`using'"
split "`using'", parse(_)
local year = `2'
display "`year'"
display `year'
When I run this program, using the line alphaoj, ind_level(4) occ_level(5) using("nat4d_2002_dl.xls"), I receive the error factor-variable and time-series operators not allowed r(101);
I am not quite sure what is being treated as a factor or time series operator.
I have replaced the split line with tokenize, and the parse statement with parse("_"), and I continue to run into errors. In that case, it says _ not found r(111);
Ideally, I would have it take the year from the filename and use that year as the local.
I am struggling with how I should perform this seemingly simple task.
An error is returned because the split command only accepts string variables. You can't pass a string directly to it. See help split for more details.
You can achieve your goal of extracting the year from the filename and storing that as a local macro. See below:
program alphaoj
syntax [varlist], using(string)
import excel `using', firstrow
gen stringvar = "`using'"
split stringvar, parse(_)
local year = stringvar2
display `year'
end
alphaoj, using("nat4d_2002_dl.xls")
The last line prints "2002" to the console.
Alternative solution that avoids creating an extra variable:
program alphaoj
syntax [varlist], using(string)
import excel `using', firstrow
local year = substr("`using'",7,4)
di `year'
end
alphaoj, using("nat4d_2002_dl.xls")
Please note that this solution is reliant on the Excel files all having the exact same character structure.

unexpected number '0.1' near '.'

I'm creating a roblox game for the first time, but I got an error in my LUA code to the point where it says: unexpected number '0.1' near '.'
ScreenGui.Parent = game.Players.1.LocalPlayer:WaitForChild("PlayerGui")
I'm trying to make a GUI, but in my players folder I have a subfolder called 1, The 1 doesn't get recognized in the PATH, so my question is, how do I make it, so that the 1 gets recognized as an actual PATH/function instead of just a random integer inside the PATH/function?
You cannot use a number in combination with the index operator ..
Correct Lua syntax would be ScreenGui.Parent = game.Players[1].LocalPlayer:WaitForChild("PlayerGui")
I don't know how this is related to player folders and subfolders in Roblox. If using numbers for folder names causes problems, use other names.

Pipe character ignored in SPSS syntax

I am trying to use the pipe character "|" in SPSS syntax with strange results:
In the syntax it appears like this:
But when I copy this line from the syntax window to here, this is what I get:
SELECT IF(SEX = 1 SEX = 2).
The pipe just disappears!
If I run this line, this is the output:
SELECT IF(SEX = 1 SEX = 2).
Error # 4007 in column 20. Text: SEX
The expression is incomplete. Check for missing operands, invalid operators,
unmatched parentheses or excessive string length.
Execution of this command stops.
So the pipe is invisible to the program too!
When I save this syntax and reopen it, the pipe is gone...
The only way I found to get SPSS to work with the pipe is when I edited the syntax (adding the pipe) and saved it in an alternative editor (notepad++ in this case). Now, without opening the syntax, I ran it from another syntax using insert command, and it worked.
EDIT: some background info:
I have spss version 23 (+service pack 3) 64 bit.
The same things happens if I use my locale (encoding: windows-1255) or Unicode (Encoding: UTF-8). Suspecting my Hebrew keyboard I tried copying syntax from the web with same results.
Can anyone shed any light on this subject?
Turns out (according to SPSS support) that's a version specific (ver. 21) bug and was fixed in later versions.

How do you define the length of a parameter in ESC/POS?

I need to be able to print Hebrew characters on my Epson TM-T20ii. I am trying to get my printer to switch to character code page 36(PC862) using
ESC t36
for some reason the printer is switching to code page 3 and then printing the number 6.
Is there a way to let the printer know that the 6 is part of my command?
If you know of a different workaround please comment below.
Thanks
You are making a mistake, you aren't meant to replace n with an actual number.
The proper syntax in your case would be ←t$
Explanation: the manual says "ESC t n", n referring to the page sheet, however you don't replace n with a number rather with the ASCII character n, so in your example 36 = $ because $ is the 36th character on the ASCII table.

lua: why the character "$" cause "unexpected symbol near $"

I am newbie in Lua. I write a script in which there is a line
ISH_activation.getState() = CONST_ACTIVATION_STATE$ON
Then, I need to write another C++ script to read this line from Lua and parse it. Now the problem is that, when I try to debug the lua script itself, at this line it gives me the error "unexpected symbol near '$'".
I don't know why this would happen. Is format like "CONST_ACTIVATION_STATE$ON" not allowed in Lua? And is "$" a special character in Lua that we cannot use it?(But I didn't find anything mentioning this)....
Well, did you find anything saying that you can use $? :)
Yes, you cannot use dollar signs in identifiers. From the manual:
Names (also called identifiers) in Lua can be any string of letters, digits, and underscores, not beginning with a digit. Identifiers are used to name variables, table fields, and labels.
If you really want to keep the dollar sign you could use strings instead
"CONST_ACTIVATION_STATE$ON"

Resources