plan_war/main11.lua

88 lines
1.4 KiB
Lua
Raw Permalink Normal View History

2025-05-13 17:52:48 +08:00
print(math.abs(-15))
print('hello world!')
print('hello', 'world')
print('hello' .. 'world')
local a = 4
local b = 3.12
local c = 'hello'
local d = [[abcdefg]]
print(a, b, c, d)
local one, two, three = 'one', 2, false
print(one, two, three)
GlobalVar = 23
print(_G['GlobalVar'])
local name = 'Qinga'
print('Hello, my name is ' .. name)
name = 'Sad'
print('this is a cool name, ' .. name)
a = 'ddddddd'
b = 'ccccccc'
c = [[
abdsde
adfadfd
fgfgfgfg
]]
print(a)
print(b)
print(c)
local x = 'adfdfdfdf'
print(#x)
local num = 22
local str = tostring(num)
print(type(num), type(str))
print('what is your name')
--local ans = io.read()
--print('Name:', ans)
local tbl = {'this', 2, 93, true, {'ok', 'cool'}}
for i = 1, #tbl do
print(tbl[i])
end
--io.output('myfile.txt')
--io.input('myfile.txt')
--local fileData = io.read('*all')
--print(fileData)
--io.close()
--local file = io.open('myfile.txt', 'w')
--if file ~= nil then
-- file:write('aaaaaaaa, bit')
-- file:close()
--else
-- print('can not open the file')
--end
--local file = io.open('myfile.txt', 'r')
----if file ~= nil then
-- print(file:read('*all'))
-- file:close()
--else
-- print('can not open')
--end
local file = io.open('myfile.txt', 'a')
if file ~= nil then
print(file:write('\nAppended text'))
file:close()
else
print('can not ')
end
local mod = require('custom')
print(mod.sum(10, 4))
mod.sayHello('junge')