drarem Posted December 14, 2015 Posted December 14, 2015 I thought this would be an easy task.. how do I get a substring, like the 5th byte of a string? Such as this: "ABCDEFG" > return 'E' Thanks Quote
thehankinator Posted December 14, 2015 Posted December 14, 2015 Have you tried string.sub()? http://www.lua.org/pil/20.html Quote
drarem Posted December 14, 2015 Author Posted December 14, 2015 Here's what happens, where fileinput starts out as a table.. local astr = fileinput.tostring() System:Print(astr) -- looks ok System:Print("as:cahr = :"..string:sub(astr,1,1)) -- error, expecting string got table Quote
thehankinator Posted December 14, 2015 Posted December 14, 2015 Here's what happens, where fileinput starts out as a table.. local astr = fileinput.tostring() System:Print(astr) -- looks ok System:Print("as:cahr = :"..string:sub(astr,1,1)) -- error, expecting string got table change string:sub() to string.sub() you have stringcolonsub(), you need stringperiodsub() Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.