lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 21/06/2012, at 3:36 PM, meino.cramer@gmx.de wrote:

> Hi,
> 
> from a string in a table like this
> 
>    a={}
>    a[1]="hello"
> 
> I want to access/retrieve the n-th character.
> 
> Somewhere I read about, that in lua everything is a table,
> therefore I thought that
> 
>    =a[1][1]

Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> a = { "hello"}
> =a[1]:sub(3,3)
l

See http://www.lua.org/manual/5.2/manual.html#pdf-string.sub