Giter VIP home page Giter VIP logo

Comments (4)

kevinofsias avatar kevinofsias commented on July 4, 2024

这篇博客的评论中有人这样说过。https://blog.codingnow.com/2012/04/lua_multi_states_database.html

“大侠,看了以后我有个疑惑,求解惑。既然要多个lua_State共享一份数据,为什么不把这些静态数据像加载到一个lua_State* L中,以后创建的lua_State都以L子线程的发生创建,这样不就可以读共享数据了吗?
L1 = lua_newthread(L)我在Lua程序设计那本书上看到的,也写过小例子测试过,不知道这样会不会有什么缺点,望大侠不吝赐教”

from sluaunreal.

pangweiwei avatar pangweiwei commented on July 4, 2024

1.如果是1个USluaComponent维护所有界面,每个界面用一个脚本去控制,还需要一些共有数据脚本去存储数据,比如策划表,也有可能数据脚本保存一些共有变量,但是创建出来的新界面脚本需要如何去调用自己的init或tick函数,还有如何销毁某个界面。

USluaComponent的唯一作用是拿到uworld指针和tick,除此之外没有任何其他作用,uworld指针也仅仅用于load widget ui(这部分代码一般都需要根据项目重写,所以很可能实际代码中不需要USluaComponent,仅需要luastate),这样的情况下,slua目前的设计是一个luastate加载所有界面,每个界面对应一个lua文件。

同时目前slua的设计,支持多state,但确实尚未考虑数据共享问题,未来会考虑添加。

from sluaunreal.

kevinofsias avatar kevinofsias commented on July 4, 2024

好的,期待多state下数据共享的实现,脚本底层可以用script_mgr和script方式去管理,各脚本独立state又可以访问script_mgr下LuaState的共享数据。

from sluaunreal.

ZuoEr avatar ZuoEr commented on July 4, 2024

初步使用看下来用单个state没什么问题,数据也很方便。

from sluaunreal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.