Sample code for 30+ languages & platforms
Lua

Load StringTable from a StringBuilder

Demonstrates how to load a StringTable from the text contained in a Chilkat StringBuilder object.

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

local success = false

local strTab = chilkat.StringTable.new()
local sb = chilkat.StringBuilder.new()

sb:append("This is line 1\r\n")
sb:append("An empty line follows...\r\n")
sb:append("\r\n")
sb:append("This is line 4\r\n")

strTab:append_from_sb(sb)

local i = 0
local numStrings = strTab.count
while i < numStrings do
    print(i .. ": " .. strTab:string_at(i))
    i = i + 1
end