Code: Select all
function love.load()
local file = assert(io.open("obj.txt", "r"))
file:seek("set")
stringTwo = file:read("*line")
end
function love.update()
end
function love.draw()
love.graphics.print(stringTwo, 100, 100)
end
Code: Select all
function love.load()
local file = assert(io.open("obj.txt", "r"))
file:seek("set")
stringTwo = file:read("*line")
end
function love.update()
end
function love.draw()
love.graphics.print(stringTwo, 100, 100)
end
Code: Select all
function love.load()
Ilength = 0
local file = assert(io.open("obj.txt", "r"))
items = {}
for line in file:lines() do
Ilength = Ilength + 1
table.insert(items, line);
end
math.randomseed(os.time())
math.random()
end
function love.update()
end
function love.draw()
love.graphics.print(items[selector(1, Ilength)], 100, 100)
end
function selector(range1, range2)
outcome = math.random(range1, range2)
end
Code: Select all
function selector(range1, range2)
outcome = math.random(range1, range2)
end
Code: Select all
function selector(range1, range2)
local outcome = math.random(range1, range2)
return outcome
end
--or
function selector(range1, range2)
return math.random(range1, range2)
end
Code: Select all
function love.draw()
love.graphics.print(items[math.random(1, Ilength)], 100, 100)
end
Users browsing this forum: Bing [Bot], Google [Bot] and 2 guests