kurapica / ploop Goto Github PK
View Code? Open in Web Editor NEWPrototype Lua object-oriented program system and frameworks.
Home Page: https://discord.gg/6hD4sdUtgp
License: MIT License
Prototype Lua object-oriented program system and frameworks.
Home Page: https://discord.gg/6hD4sdUtgp
License: MIT License
Using latest version in Wow Classic
Example class:
PLoop(function(_ENV)
class "Announcement" (function(_ENV)
property "title" { Require = true, Type = String }
property "created" { Require = true, Type = String }
property "author" { Require = true, Type = String }
property "body" { Require = true, Type = String }
end)
end)
// OK
test = Announcement{ title = 'title', created = 'created', author = 'author', body = 'body' }
// OK (Error: title must be string )
test = Announcement{ title = 1, created = 'created', author = 'author', body = 'body' }
// OK (Error: title cannot be nil)
test = Announcement{ title = 'title', created = 'created', author = 'author', body = 'body' }
test.title = nil
// Problem (no error thrown)
test = Announcement{ title = nil, created = 'created', author = 'author', body = 'body' }
Am i doing something wrong?
I can see a sudden flash of a Console when I launch my Unity3d project with "require('PLoop.init')" under a Framework called xLua~
I can not figure out what causes this~
Hello kurapica,I'm using PLoop in my project. But why my list element's value is error? By the way,the element is a predefined struct.
`require("3rd.PLoop.init");
do
import "System" -- import a namespace
import "System.Collections"
struct "FieldDes"
{
{ name = "field_order", type = System.Number },
{ name = "field_type", type = System.String },
{ name = "field_value", type = System.Any },
}
struct "Person"
{
{ name = "name", type = Struct },
{ name = "age", type = List },
__init = function(p)
p.name = FieldDes(1 , "c32" , "a");
p.age = List(3,FieldDes(2 , "H" , "c"));
end,
}
local o = Person()
o.age[1].field_value = "a";
o.age[2].field_value = "b";
---print "b",that's not my ecpected,it should be "a"
print(o.age[1].field_value);
print(o.name.field_value)
end`
VSCode和Rider都实验了,Rider里装的EmmyLua插件,都无法再跳转函数了
Implement the access modifiers private
, protected
, and public
. This would replace all your identifiers such as __private_variable
.
private
can be implemented using closures:
function get_x = (function()
local x = -- Variable x is protected by a closure
return function()
return x
end
end)()
Without access modifiers, you can't have true objects.
Install What?
I can not find a zip-file~
I want to contribute voluntarily to the project. I want to give you a logo. What do you say?
Just be sure , thank you!
Hi, I've come across your library some time ago but haven't had the opportunity to test it yet. I'm really glad it is still actively maintained, you have done an enormous amount of impressive work so far, especially with the full, clean documentation!
I'm now considering using PLoop in one of my projects, but I'm concerned about performance because in this specific environment we're talking about multiple (tens to hundreds) "resources" which are actually separate Lua virtual machines embedded in the game. Almost all of them are started at once when the gameplay starts (with minor exceptions). Each of these resources would of course need to require()
PLoop on its own, I don't think it's possible to share anything between these VMs.
I've seen your comment in this issue #7 :
That doesn't mean the PLoop is slower than normal lua codes, the PLoop is heavy in the definition phase, but will be the same like common Lua during the runtime phase.
What exactly do you mean by "heavy"? What numbers are we speaking of (microseconds, miliseconds?). Do you maybe have some benchmarks that you could present to illustrate the total impact of including this wonderful library in some existing project?
Thanks in advance, keep up the great work!
Today, I have wanted to view the online documentation, and I seen that it is missing. Only the home page exists, and click on a link redirect to the home page...
Yes, it's me!
________Mac OS v10.13.2
I find new issue, ehhhh, i am not sure it is caused by PLoop, but i'd like put it forward (Maybe you can improve PLoop
in some way~~~~)
here is the stack:
LuaException: /Users/yi/Workspace/Neo/Assets/StreamingAssets/LuaScripts/./PLoop/System/IO/Path.lua:20: 'popen' not supported
stack traceback:
[C]: in function 'error'
/Users/yi/Workspace/Neo/Assets/StreamingAssets/LuaScripts/./PLoop/Core.lua:3685: in metamethod '__newindex'
/Users/yi/Workspace/Neo/Assets/StreamingAssets/LuaScripts/./PLoop/System/IO/Path.lua:20: in function </Users/yi/Workspace/Neo/Assets/StreamingAssets/LuaScripts/./PLoop/System/IO/Path.lua:15>
(...tail calls...)
/Users/yi/Workspace/Neo/Assets/StreamingAssets/LuaScripts/./PLoop/Core.lua:3699: in function </Users/yi/Workspace/Neo/Assets/StreamingAssets/LuaScripts/./PLoop/Core.lua:3698>
/Users/yi/Workspace/Neo/Assets/StreamingAssets/LuaScripts/./PLoop/System/IO/Path.lua:15: in main chunk
[C]: in function 'require'
/Users/yi/Workspace/Neo/Assets/StreamingAssets/LuaScripts/./PLoop/init.lua:28: in main chunk
[C]: in function 'require'
[string "UI.SceneLogin"]:6: in main chunk
XLua.LuaEnv.ThrowExceptionFromError (System.Int32 oldTop) (at Assets/XLua/Src/LuaEnv.cs:429)
XLua.LuaEnv.DoString (System.Byte[] chunk, System.String chunkName, XLua.LuaTable env) (at Assets/XLua/Src/LuaEnv.cs:262)
XLua.LuaEnv.DoString (System.String chunk, System.String chunkName, XLua.LuaTable env) (at Assets/XLua/Src/LuaEnv.cs:276)
Bingo.Lua.LuaManager.DoFile (System.String fileName, XLua.LuaTable env) (at Assets/Scripts/Lua/LuaManager.cs:152)
Bingo.Lua.LuaBehaviour.Awake () (at Assets/Scripts/Lua/LuaBehaviour.cs:56)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.