Skip to content

Mjaucher/WPTXT

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WPTXT Logo

WPTXT is a programming language for storing and exchanging data, written for lua.

Syntax:

Types

There are five Types in WPTXT: STRING, NUMBER, BOOLEAN, LIST, NOTHING. The NOTHING Type is returned by interpreter if the value is equals nil. Value with Type BOOLEAN can only be equal to either True or False.

Values

All Values have Name and Type:

Value1?STRING:WPTXT
Value2?NUMBER:123.45
Value3?BOOLEAN:true
Value4?LIST:One|Two|Three|Four|Five
Value5?NOTHING:%NIL%

Objects

Objects are needed to store values. They must have their own Name and be denoted by -> <- at the beginning and at the end:

->Account
FullName?STRING:Mark Mjaucher
Login?NOTHING:%NIL%
Age?NUMBER:26
PhoneNumbers?LIST:+355-69-123-4567|+355-69-711-0711
IsPrivate?BOOLEAN:True
<-

There can be an unlimited number of Objects in one file.

Getting started with WPTXT

1. Initialization

The WPTXT.lua file needs to be thrown into the project and required from it:

WPTXT = require("WPTXT")

The next step is to OPEN the file:

WPTXT:OPEN("Test") --Test is the file name (Test.WPTXT)

2. Methods:

2.1 OBJ()

Function OBJ() сreates a new Object:

WPTXT:OBJ("Account")

2.2 ADD()

Function ADD() сreates a new Value:

WPTXT:ADD("Account", "FullName", "Mark Mjaucher") --STRING

WPTXT:ADD("Account", "Login", nil) --NOTHING

WPTXT:ADD("Account", "Age", 26) --NUMBER

WPTXT:ADD("Account", "PhoneNumbers", { "+355-69-123-4567", "+355-69-711-0711" }) --LIST

WPTXT:ADD("Account", "IsPrivate", false) --BOOLEAN

2.3 GET()

Function GET() gives Value:

local FullName = WPTXT:GET("Account", "FullName")
local PhoneNumbers = WPTXT:GET("Account", "PhoneNumbers")

print(FullName)

for ind, pnumber in ipairs(PhoneNumbers) do
   print(pnumber)
end

> Mark Mjaucher
> +355-69-123-4567
> +355-69-711-0711

2.4 SET()

Function SET() changes Value:

local IsPrivate = WPTXT:GET("Account", "Login")

print(IsPrivate)

WPTXT:SET("Account", "Login", false)

print(IsPrivate)

> %NIL%
> false

3. Finishing

To save your progress, use the SAVE() function:

WPTXT:SAVE()

License

WPTXT is distributed under the terms of the MIT License.

Releases

No releases published

Packages

No packages published

Languages

  • Lua 100.0%